Allow specifying routine language
This commit is contained in:
parent
4787b57d30
commit
ce3d18e538
|
@ -722,8 +722,8 @@ if (!defined("DRIVER")) {
|
|||
|
||||
/** 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;
|
||||
|
@ -753,6 +753,7 @@ if (!defined("DRIVER")) {
|
|||
"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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -763,6 +764,13 @@ if (!defined("DRIVER")) {
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
|
|||
}
|
||||
$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.'),
|
||||
|
@ -40,6 +40,7 @@ if ($_POST) {
|
|||
|
||||
<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);
|
||||
|
|
Loading…
Reference in a new issue