/** Get information about stored routine
* @param string
- * @param string FUNCTION or PROCEDURE
- * @return array ("fields" => array("field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ), "returns" => , "definition" => )
+ * @param string "FUNCTION" or "PROCEDURE"
+ * @return array ("fields" => array("field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ), "returns" => , "definition" => , "language" => )
*/
function routine($name, $type) {
global $connection, $enum_length, $inout, $types;
"fields" => $fields,
"returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]),
"definition" => $match[17],
+ "language" => "SQL", // available in information_schema.ROUTINES.PARAMETER_STYLE
);
}
return get_rows("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB));
}
+ /** Get list of available routine languages
+ * @return array
+ */
+ function routine_languages() {
+ return array("SQL");
+ }
+
/** Begin transaction
* @return bool
*/
}
$dropped = drop_create(
"DROP $routine " . idf_escape($PROCEDURE),
- "CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . rtrim("\n$_POST[definition]", ";") . ";",
+ "CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . (in_array($_POST["language"], routine_languages()) ? " LANGUAGE $_POST[language]" : "") . rtrim("\n$_POST[definition]", ";") . ";",
substr(ME, 0, -1),
lang('Routine has been dropped.'),
lang('Routine has been altered.'),
<form action="" method="post" id="form">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
+<?php echo lang('Language'); ?>: <?php echo html_select("language", routine_languages(), $row["language"]); ?>
<table cellspacing="0" class="nowrap">
<?php
edit_fields($row["fields"], $collations, $routine);