query("DROP $routine " . idf_escape($_GET["procedure"])) && $_POST["drop"]) { redirect(substr($SELF, 0, -1), lang('Routine has been dropped.')); } if (!$_POST["drop"]) { $set = array(); $fields = array_filter((array) $_POST["fields"], 'strlen'); ksort($fields); foreach ($fields as $field) { $set[] = (in_array($field["inout"], $inout) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET"); } if ($mysql->query( "CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . " $_POST[definition]" )) { redirect(substr($SELF, 0, -1), (strlen($_GET["procedure"]) ? lang('Routine has been altered.') : lang('Routine has been created.'))); } } $error = $mysql->error; } page_header(strlen($_GET["procedure"]) ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . htmlspecialchars($_GET["procedure"]) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure')) ); $collations = get_vals("SHOW CHARACTER SET"); if ($_POST) { $row = $_POST; $row["fields"] = (array) $row["fields"]; ksort($row["fields"]); $row["fields"] = array_values($row["fields"]); if ($_POST["add"]) { array_splice($row["fields"], key($_POST["add"]), 0, array(array())); } elseif (!$_POST["drop_col"]) { echo "

" . lang('Unable to operate routine') . ": " . htmlspecialchars($error) . "

\n"; } } elseif (strlen($_GET["procedure"])) { $row = routine($_GET["procedure"], $routine); $row["name"] = $_GET["procedure"]; } else { $row = array("fields" => array()); } ?>

: " maxlength="64" />