]> git.joonet.de Git - adminer.git/commitdiff
Move unsigned to Driver
authorJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 12:58:15 +0000 (13:58 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 12:58:15 +0000 (13:58 +0100)
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/drivers/sqlite.inc.php
adminer/include/bootstrap.inc.php
adminer/include/driver.inc.php
adminer/include/editing.inc.php
plugins/drivers/clickhouse.php

index 472e7912ad6ea50d7ee7da60da6b763053afe10f..d8410d6b72b8e22334bbf03d63c40574854317e9 100644 (file)
@@ -710,7 +710,6 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
                return array(
                        'possible_drivers' => array("SQLSRV", "PDO_SQLSRV", "PDO_DBLIB"),
                        'jush' => "mssql",
-                       'unsigned' => array(),
                );
        }
 }
index d5492825252b4af58c788a41513f104ebb32d3dd..2ab2e5171100ad13ccc9c678729badad57b79597 100644 (file)
@@ -281,6 +281,7 @@ if (!defined("DRIVER")) {
 
 
        class Driver extends SqlDriver {
+               var $unsigned = array("unsigned", "zerofill", "unsigned zerofill");
                var $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "FIND_IN_SET", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
                var $functions = array("char_length", "date", "from_unixtime", "lower", "round", "floor", "ceil", "sec_to_time", "time_to_sec", "upper");
                var $grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
@@ -1197,13 +1198,12 @@ if (!defined("DRIVER")) {
        }
 
        /** Get driver config
-       * @return array ['possible_drivers' => , 'jush' => , 'unsigned' => ]
+       * @return array ['possible_drivers' => , 'jush' => ]
        */
        function driver_config() {
                return array(
                        'possible_drivers' => array("MySQLi", "MySQL", "PDO_MySQL"),
                        'jush' => "sql", ///< @var string JUSH identifier
-                       'unsigned' => array("unsigned", "zerofill", "unsigned zerofill"), ///< @var array number variants
                );
        }
 }
index 0e11e878461b9c1f02eea15e0cdd2369c919cb03..6a0d75f412bda6e8deb6259de7546903dababfc7 100644 (file)
@@ -549,7 +549,6 @@ ORDER BY PROCESS
                return array(
                        'possible_drivers' => array("OCI8", "PDO_OCI"),
                        'jush' => "oracle",
-                       'unsigned' => array(),
                );
        }
 }
index c08bce144c8f171b8aaf750b67eb5a91f63e4439..103a70154ecf3f25bb8934c57369dce3fd220622 100644 (file)
@@ -940,7 +940,6 @@ AND typelem = 0"
                return array(
                        'possible_drivers' => array("PgSQL", "PDO_PgSQL"),
                        'jush' => "pgsql",
-                       'unsigned' => array(),
                );
        }
 }
index d428fbd37e59e810790a42103868f3dc316ab186..4b68374043c4728ddfa84a8f8b638cba265016c1 100644 (file)
@@ -742,7 +742,6 @@ if (isset($_GET["sqlite"])) {
                return array(
                        'possible_drivers' => array("SQLite3", "PDO_SQLite"),
                        'jush' => "sqlite",
-                       'unsigned' => array(),
                );
        }
 }
index a0ac55dfa075267b7eb7747176a517abed819246..7c34a0a57efdbfd8ffcceccb93050878dbc31a88 100644 (file)
@@ -35,7 +35,7 @@ if ($_GET["script"] == "version") {
        exit;
 }
 
-global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $permanent, $has_token, $token, $translations, $unsigned, $VERSION; // allows including Adminer inside a function
+global $adminer, $connection, $driver, $drivers, $enum_length, $error, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $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"];
@@ -82,7 +82,6 @@ $on_actions = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT"; ///< @var strin
 $config = driver_config();
 $possible_drivers = $config['possible_drivers'];
 $jush = $config['jush'];
-$unsigned = $config['unsigned'];
 
 define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
 define("DB", $_GET["db"]); // for the sake of speed and size
index 3aaf801b01024adc25814d123ad7c6de1975a41b..60a3908ccdf7b9d5b8c3bb66a4a3ddc436f107d7 100644 (file)
@@ -26,6 +26,7 @@ abstract class SqlDriver {
        var $_conn;
        protected $types = array(); ///< @var array [$description => [$type => $maximum_unsigned_length, ...], ...]
        var $editFunctions = array(); ///< @var array of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
+       var $unsigned = array(); ///< @var array number variants
        var $operators = array(); ///< @var array operators used in select
        var $functions = array(); ///< @var array functions used in select
        var $grouping = array(); ///< @var array grouping functions used in select
index f250963cd2daeaeae11702f404c39e307634be1d..220c2a59d59eff7f92d8b94e8a2da83023fe0e57 100644 (file)
@@ -209,7 +209,7 @@ function json_row($key, $val = null) {
 * @return null
 */
 function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_types = array()) {
-       global $driver, $unsigned, $on_actions;
+       global $driver, $on_actions;
        $type = $field["type"];
        ?><td><select name="<?php echo h($key); ?>[type]" class="type" aria-labelledby="label-type"><?php
        if ($type && !array_key_exists($type, $driver->types()) && !isset($foreign_keys[$type]) && !in_array($type, $extra_types)) {
@@ -227,7 +227,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_ty
        <?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?>
        aria-labelledby="label-length"><td class="options"><?php
        echo ($collations ? "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>' : '');
-       echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
+       echo ($driver->unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($driver->unsigned, $field["unsigned"]) . '</select>' : '');
        echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>'
                . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"]))
                . '</select>' : ''
@@ -269,10 +269,10 @@ function process_length($length) {
 * @return string
 */
 function process_type($field, $collate = "COLLATE") {
-       global $unsigned, $jush;
+       global $driver, $jush;
        return " $field[type]"
                . process_length($field["length"])
-               . (preg_match(number_type(), $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
+               . (preg_match(number_type(), $field["type"]) && in_array($field["unsigned"], $driver->unsigned) ? " $field[unsigned]" : "")
                . (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " $collate " . ($jush == "mssql" ? $field["collation"] : q($field["collation"])) : "")
        ;
 }
index 2ed7c76d87290d243c38ad4700c58b5fdc435aa1..b76bea52503d41f800283bf9e29a9ff57d458b62 100644 (file)
@@ -384,7 +384,6 @@ if (isset($_GET["clickhouse"])) {
        function driver_config() {
                return array(
                        'jush' => "clickhouse",
-                       'unsigned' => array(),
                );
        }
 }