2007-07-16 23:08:24 +00:00
|
|
|
<?php
|
2009-08-29 13:57:50 +00:00
|
|
|
$PROCEDURE = $_GET["procedure"];
|
2007-07-16 23:08:24 +00:00
|
|
|
$routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE");
|
2013-05-08 14:55:08 +00:00
|
|
|
$row = $_POST;
|
|
|
|
$row["fields"] = (array) $row["fields"];
|
2007-07-16 23:08:24 +00:00
|
|
|
|
2013-05-08 18:43:53 +00:00
|
|
|
if ($_POST && !process_fields($row["fields"]) && !$error) {
|
|
|
|
$temp_name = "$row[name]_adminer_" . uniqid();
|
|
|
|
drop_create(
|
|
|
|
"DROP $routine " . idf_escape($PROCEDURE),
|
|
|
|
create_routine($routine, $row),
|
2013-05-13 18:12:28 +00:00
|
|
|
"DROP $routine " . idf_escape($row["name"]),
|
2013-05-08 18:43:53 +00:00
|
|
|
create_routine($routine, array("name" => $temp_name) + $row),
|
|
|
|
"DROP $routine " . idf_escape($temp_name),
|
|
|
|
substr(ME, 0, -1),
|
|
|
|
lang('Routine has been dropped.'),
|
|
|
|
lang('Routine has been altered.'),
|
|
|
|
lang('Routine has been created.'),
|
2013-05-13 18:12:28 +00:00
|
|
|
$PROCEDURE,
|
|
|
|
$row["name"]
|
2013-05-08 18:43:53 +00:00
|
|
|
);
|
2007-07-16 23:08:24 +00:00
|
|
|
}
|
2009-07-20 12:12:55 +00:00
|
|
|
|
2010-01-09 23:33:41 +00:00
|
|
|
page_header(($PROCEDURE != "" ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . h($PROCEDURE) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure'))), $error);
|
2007-07-17 09:12:15 +00:00
|
|
|
|
2013-05-08 14:55:08 +00:00
|
|
|
if (!$_POST && $PROCEDURE != "") {
|
|
|
|
$row = routine($PROCEDURE, $routine);
|
|
|
|
$row["name"] = $PROCEDURE;
|
|
|
|
}
|
|
|
|
|
2007-07-17 09:12:15 +00:00
|
|
|
$collations = get_vals("SHOW CHARACTER SET");
|
2009-06-29 10:10:59 +00:00
|
|
|
sort($collations);
|
2013-05-08 14:55:08 +00:00
|
|
|
$routine_languages = routine_languages();
|
2007-07-16 23:08:24 +00:00
|
|
|
?>
|
2007-07-17 09:12:15 +00:00
|
|
|
|
|
|
|
<form action="" method="post" id="form">
|
2013-01-31 05:35:51 +00:00
|
|
|
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
|
2011-06-04 01:37:43 +00:00
|
|
|
<?php echo ($routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) : ""); ?>
|
2013-07-15 17:13:41 +00:00
|
|
|
<input type="submit" value="<?php echo lang('Save'); ?>">
|
2010-01-28 15:17:20 +00:00
|
|
|
<table cellspacing="0" class="nowrap">
|
|
|
|
<?php
|
|
|
|
edit_fields($row["fields"], $collations, $routine);
|
|
|
|
if (isset($_GET["function"])) {
|
|
|
|
echo "<tr><td>" . lang('Return type');
|
|
|
|
edit_type("returns", $row["returns"], $collations);
|
|
|
|
}
|
|
|
|
?>
|
2007-07-16 23:08:24 +00:00
|
|
|
</table>
|
2010-04-26 16:22:24 +00:00
|
|
|
<p><?php textarea("definition", $row["definition"]); ?>
|
2007-07-17 09:12:15 +00:00
|
|
|
<p>
|
2009-07-11 20:30:40 +00:00
|
|
|
<input type="submit" value="<?php echo lang('Save'); ?>">
|
2010-10-18 21:57:39 +00:00
|
|
|
<?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
|
2011-03-08 12:43:05 +00:00
|
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
2007-07-17 09:12:15 +00:00
|
|
|
</form>
|