]> git.joonet.de Git - adminer.git/commitdiff
Move $inout to Driver
authorJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 13:49:08 +0000 (14:49 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 13:49:08 +0000 (14:49 +0100)
adminer/drivers/mysql.inc.php
adminer/include/bootstrap.inc.php
adminer/include/driver.inc.php
adminer/include/editing.inc.php
adminer/index.php

index a4336a19048a2100cec2533692468496608eb92a..1a3d765e74fa22d13c331bf5ef0e26318f036213 100644 (file)
@@ -955,11 +955,11 @@ if (!defined("DRIVER")) {
        * @return array ["fields" => ["field" => , "type" => , "length" => , "unsigned" => , "inout" => , "collation" => ], "returns" => , "definition" => , "language" => ]
        */
        function routine($name, $type) {
-               global $connection, $enum_length, $inout, $driver;
+               global $connection, $enum_length, $driver;
                $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar");
                $space = "(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";
                $type_pattern = "((" . implode("|", array_merge(array_keys($driver->types()), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]|$enum_length)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";
-               $pattern = "$space*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
+               $pattern = "$space*(" . ($type == "FUNCTION" ? "" : $driver->inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
                $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2);
                preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match);
                $fields = array();
index 8a23fe731ad1ecda12f72f95981ab637fe198286..f2a57fe5995f7390e9906a82c48c0234d8b5d342 100644 (file)
@@ -35,7 +35,7 @@ if ($_GET["script"] == "version") {
        exit;
 }
 
-global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $inout, $jush, $LANG, $langs, $permanent, $has_token, $token, $translations, $VERSION; // allows including Adminer inside a function
+global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $jush, $LANG, $langs, $permanent, $has_token, $token, $translations, $VERSION; // allows including Adminer inside a function
 
 if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility
        $_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];
index ad25c4447765fe4e6ce010eb894312b752e5c908..102f118dc01e6c81f658646a712f96ef22798739 100644 (file)
@@ -34,6 +34,7 @@ abstract class SqlDriver {
        var $functions = array(); ///< @var array functions used in select
        var $grouping = array(); ///< @var array grouping functions used in select
        var $onActions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var string used in foreign_keys()
+       var $inout = "IN|OUT|INOUT";
 
        /** Create object for performing database operations
        * @param Db
index f738d2da2db27db52070fb5c3523561ede7f5493..d9686d4e1a08e060370399f3b7c3722c740d1155 100644 (file)
@@ -338,7 +338,7 @@ function type_class($type) {
 * @return null
 */
 function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
-       global $inout;
+       global $driver;
        $fields = array_values($fields);
        $default_class = (($_POST ? $_POST["defaults"] : adminer_setting("defaults")) ? "" : " class='hidden'");
        $comment_class = (($_POST ? $_POST["comments"] : adminer_setting("comments")) ? "" : " class='hidden'");
@@ -372,7 +372,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
                $display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i])) && (support("drop_col") || $orig == "");
                ?>
 <tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
-<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : "") . "<th>"; ?>
+<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $driver->inout), $field["inout"]) : "") . "<th>"; ?>
 <?php if ($display) { ?>
 <input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name">
 <?php } ?>
@@ -521,13 +521,13 @@ function create_trigger($on, $row) {
 * @return string
 */
 function create_routine($routine, $row) {
-       global $inout, $jush;
+       global $driver, $jush;
        $set = array();
        $fields = (array) $row["fields"];
        ksort($fields); // enforce fields order
        foreach ($fields as $field) {
                if ($field["field"] != "") {
-                       $set[] = (preg_match("~^($inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
+                       $set[] = (preg_match("~^($driver->inout)\$~", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
                }
        }
        $definition = rtrim($row["definition"], ";");
index 8e004ea9c9b2c22de87dfac3b2668c52d655edb4..c2f40800e6d00d7f01c5ddd164e7217423068312 100644 (file)
@@ -13,7 +13,6 @@ include "./include/bootstrap.inc.php";
 include "./include/tmpfile.inc.php";
 
 $enum_length = "'(?:''|[^'\\\\]|\\\\.)*'";
-$inout = "IN|OUT|INOUT";
 
 if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) {
        $_GET["edit"] = $_GET["select"];