]> git.joonet.de Git - adminer.git/commitdiff
Allow specifying routine language
authorJakub Vrana <jakub@vrana.cz>
Fri, 3 Jun 2011 13:45:33 +0000 (15:45 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 3 Jun 2011 13:45:33 +0000 (15:45 +0200)
adminer/drivers/mysql.inc.php
adminer/procedure.inc.php

index 42f1876d12b95c8b23b6d9ad97a06117b017c77c..23286485499d74250399760d528c3d6d86824ca4 100644 (file)
@@ -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
        */
index 198ae6e7138abf6ea8ca548192ec9295d8988ed7..c047bd6c916de1aedd83e2c87ad85968ae47bc19 100644 (file)
@@ -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);