]> git.joonet.de Git - adminer.git/commitdiff
Wrap long lines
authorJakub Vrana <jakub@vrana.cz>
Wed, 12 Mar 2025 10:38:28 +0000 (11:38 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 12 Mar 2025 10:43:21 +0000 (11:43 +0100)
15 files changed:
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/include/connect.inc.php
adminer/include/editing.inc.php
adminer/include/lang.inc.php
adminer/schema.inc.php
adminer/table.inc.php
adminer/user.inc.php
phpcs.xml
plugins/drivers/clickhouse.php
plugins/dump-alter.php
plugins/foreign-system.php
plugins/table-structure.php

index c5ecfdec9d1cd8825b8d97846c39aba9233e25e9..88528e9a95814a407990caff7f843c5e963a261c 100644 (file)
@@ -509,7 +509,16 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
                foreach ($comments as $key => $val) {
                        $comment = substr($val, 9); // 9 - strlen(" COMMENT ")
                        queries("EXEC sp_dropextendedproperty @name = N'MS_Description', @level0type = N'Schema', @level0name = " . q(get_schema()) . ", @level1type = N'Table', @level1name = " . q($name) . ", @level2type = N'Column', @level2name = " . q($key));
-                       queries("EXEC sp_addextendedproperty @name = N'MS_Description', @value = " . $comment . ", @level0type = N'Schema', @level0name = " . q(get_schema()) . ", @level1type = N'Table', @level1name = " . q($name) . ", @level2type = N'Column', @level2name = " . q($key));
+                       queries("EXEC sp_addextendedproperty
+@name = N'MS_Description',
+@value = $comment,
+@level0type = N'Schema',
+@level0name = " . q(get_schema()) . ",
+@level1type = N'Table',
+@level1name = " . q($name) . ",
+@level2type = N'Column',
+@level2name = " . q($key))
+                       ;
                }
                return true;
        }
index dde060f87d24290c7a67a38ce372ae36c91729cc..0ff3cae53aa6d3ea0ecd42e9a130048f041c98f2 100644 (file)
@@ -587,7 +587,7 @@ if (!defined('Adminer\DRIVER')) {
 
        /** Get information about fields
        * @param string
-       * @return array [$name => ["field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => , "generated" => ]]
+       * @return array [$name => ["field" =>, "full_type" =>, "type" =>, "length" =>, "unsigned" =>, "default" =>, "null" =>, "auto_increment" =>, "on_update" =>, "collation" =>, "privileges" =>, "comment" =>, "primary" =>, "generated" =>]]
        */
        function fields($table) {
                global $connection;
@@ -667,7 +667,12 @@ if (!defined('Adminer\DRIVER')) {
                $return = array();
                $create_table = get_val("SHOW CREATE TABLE " . table($table), 1);
                if ($create_table) {
-                       preg_match_all("~CONSTRAINT ($pattern) FOREIGN KEY ?\\(((?:$pattern,? ?)+)\\) REFERENCES ($pattern)(?:\\.($pattern))? \\(((?:$pattern,? ?)+)\\)(?: ON DELETE ($driver->onActions))?(?: ON UPDATE ($driver->onActions))?~", $create_table, $matches, PREG_SET_ORDER);
+                       preg_match_all(
+                               "~CONSTRAINT ($pattern) FOREIGN KEY ?\\(((?:$pattern,? ?)+)\\) REFERENCES ($pattern)(?:\\.($pattern))? \\(((?:$pattern,? ?)+)\\)(?: ON DELETE ($driver->onActions))?(?: ON UPDATE ($driver->onActions))?~",
+                               $create_table,
+                               $matches,
+                               PREG_SET_ORDER
+                       );
                        foreach ($matches as $match) {
                                preg_match_all("~$pattern~", $match[2], $source);
                                preg_match_all("~$pattern~", $match[5], $target);
@@ -987,7 +992,9 @@ if (!defined('Adminer\DRIVER')) {
                global $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*\\(((?:[^'\")]|$driver->enumLength)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";
+               $enum = $driver->enumLength;
+               $type_pattern = "((" . implode("|", array_merge(array_keys($driver->types()), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]|$enum)++)\\))?"
+                       . "\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";
                $pattern = "$space*(" . ($type == "FUNCTION" ? "" : $driver->inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
                $create = get_val("SHOW CREATE $type " . idf_escape($name), 2);
                preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match);
@@ -997,7 +1004,7 @@ if (!defined('Adminer\DRIVER')) {
                        $fields[] = array(
                                "field" => str_replace("``", "`", $param[2]) . $param[3],
                                "type" => strtolower($param[5]),
-                               "length" => preg_replace_callback("~$driver->enumLength~s", 'Adminer\normalize_enum', $param[6]),
+                               "length" => preg_replace_callback("~$enum~s", 'Adminer\normalize_enum', $param[6]),
                                "unsigned" => strtolower(preg_replace('~\s+~', ' ', trim("$param[8] $param[7]"))),
                                "null" => 1,
                                "full_type" => $param[4],
@@ -1197,7 +1204,7 @@ if (!defined('Adminer\DRIVER')) {
        }
 
        /** Check whether a feature is supported
-       * @param string "check", "comment", "copy", "database", "descidx", "drop_col", "dump", "event", "indexes", "kill", "materializedview", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger"
+       * @param string "check|comment|copy|database|descidx|drop_col|dump|event|indexes|kill|materializedview|partitioning|privileges|procedure|processlist|routine|scheme|sequence|status|table|trigger|type|variables|view|view_trigger"
        * @return bool
        */
        function support($feature) {
index 6b9726f92a523c08b9c5a6ff558e71b0bfc641f3..d5e449c9fc0b739adc0870abfcf3163fd1079f5f 100644 (file)
@@ -521,7 +521,16 @@ AND c_src.TABLE_NAME = " . q($table);
        }
 
        function process_list() {
-               return get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
+               return get_rows('SELECT
+       sess.process AS "process",
+       sess.username AS "user",
+       sess.schemaname AS "schema",
+       sess.status AS "status",
+       sess.wait_class AS "wait_class",
+       sess.seconds_in_wait AS "seconds_in_wait",
+       sql.sql_text AS "sql_text",
+       sess.machine AS "machine",
+       sess.port AS "port"
 FROM v$session sess LEFT OUTER JOIN v$sql sql
 ON sql.sql_id = sess.sql_id
 WHERE sess.type = \'USER\'
index e6c3ca10993a19f6967a74aaf5f2e376cbeea3de..a62ab6fea101db6f2426320f293a1ed10a4b3c46 100644 (file)
@@ -427,7 +427,14 @@ WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
                        'timestamp with time zone' => 'timestamptz',
                );
                foreach (
-                       get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ", a.attidentity" . (min_version(12) ? ", a.attgenerated" : "") : "") . "
+                       get_rows("SELECT
+       a.attname AS field,
+       format_type(a.atttypid, a.atttypmod) AS full_type,
+       pg_get_expr(d.adbin, d.adrelid) AS default,
+       a.attnotnull::int,
+       col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ",
+       a.attidentity" . (min_version(12) ? ",
+       a.attgenerated" : "") : "") . "
 FROM pg_class c
 JOIN pg_namespace n ON c.relnamespace = n.oid
 JOIN pg_attribute a ON c.oid = a.attrelid
@@ -473,7 +480,12 @@ ORDER BY a.attnum") as $row
                $return = array();
                $table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($table));
                $columns = get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $table_oid AND attnum > 0", $connection2);
-               foreach (get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption, (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid ORDER BY indisprimary DESC, indisunique DESC", $connection2) as $row) {
+               foreach (
+                       get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption, (indpred IS NOT NULL)::int as indispartial
+FROM pg_index i, pg_class ci
+WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid
+ORDER BY indisprimary DESC, indisunique DESC", $connection2) as $row
+               ) {
                        $relname = $row["relname"];
                        $return[$relname]["type"] = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX")));
                        $return[$relname]["columns"] = array();
@@ -693,7 +705,12 @@ ORDER BY conkey, conname") as $row
                        $columns[] = $row["event_object_column"];
                }
                $return = array();
-               foreach (get_rows('SELECT trigger_name AS "Trigger", action_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers ' . "$where ORDER BY event_manipulation DESC") as $row) {
+               foreach (
+                       get_rows('SELECT trigger_name AS "Trigger", action_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement"
+FROM information_schema.triggers' . "
+$where
+ORDER BY event_manipulation DESC") as $row
+               ) {
                        if ($columns && $row["Event"] == "UPDATE") {
                                $row["Event"] .= " OF";
                        }
index df1bf7bb57c8802313da5ec973283d6f09e4d6ba..474c19b04c02819d00f2f64152296987beb46e86 100644 (file)
@@ -8,7 +8,13 @@ if (isset($_GET["import"])) {
        $_GET["sql"] = $_GET["import"];
 }
 
-if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]) || $_GET["script"] == "connect" || $_GET["script"] == "kill")) {
+if (
+       !(DB != ""
+               ? $connection->select_db(DB)
+               : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"])
+                       || $_GET["script"] == "connect" || $_GET["script"] == "kill"
+       )
+) {
        if (DB != "" || $_GET["refresh"]) {
                restart_session();
                set_session("dbs", null);
index 6d1777dcd8d45fb882d69343a514d0c2676662e1..351868ae0b943880d690fa2e349be43194898431 100644 (file)
@@ -224,13 +224,19 @@ function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_ty
        size="3"
        <?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 ? "<input list='collations' name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . " value='" . h($field["collation"]) . "' placeholder='(" . lang('collation') . ")'>" : '');
+       echo ($collations
+               ? "<input list='collations' name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . " value='" . h($field["collation"]) . "' placeholder='(" . lang('collation') . ")'>"
+               : ''
+       );
        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>' : ''
        );
-       echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $driver->onActions), $field["on_delete"]) . "</select> " : " "); // space for IE
+       echo ($foreign_keys
+               ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $driver->onActions), $field["on_delete"]) . "</select> "
+               : " " // space for IE
+       );
 }
 
 /** Get partition info
index df0622d22e8166559c598e46c5971153d2b4b60b..4477ccc5aacdbf3aa58f5408d3f45b2a6ee20517 100644 (file)
@@ -74,7 +74,7 @@ function lang($idf, $number = null) {
                        : ($LANG == 'sl' ? ($number % 100 == 1 ? 0 : ($number % 100 == 2 ? 1 : ($number % 100 == 3 || $number % 100 == 4 ? 2 : 3))) // different forms for 1, 2, 3-4, other
                        : ($LANG == 'lt' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1, 12-19, other
                        : ($LANG == 'lv' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number ? 1 : 2)) // different forms for 1 except 11, other, 0
-                       : ($LANG == 'bs' || $LANG == 'ru' || $LANG == 'sr' || $LANG == 'uk' ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other
+                       : (in_array($LANG, array('bs', 'ru', 'sr', 'uk')) ? ($number % 10 == 1 && $number % 100 != 11 ? 0 : ($number % 10 > 1 && $number % 10 < 5 && $number / 10 % 10 != 1 ? 1 : 2)) // different forms for 1 except 11, 2-4 except 12-14, other
                        : 1 // different forms for 1, other
                )))))))); // http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
                $translation = $translation[$pos];
index 680ed288c31813a98837058fb3f6d0c8a8ab433e..fefcf6617e07fe44495eaf92c7a45d6f29829811 100644 (file)
@@ -74,7 +74,9 @@ foreach ($schema as $name => $table) {
                        $left1 = $left - $table_pos[$name][1];
                        $i = 0;
                        foreach ($ref[0] as $source) {
-                               echo "\n<div class='references' title='" . h($target_name) . "' id='refs$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$source]["pos"] . "em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: " . (-$left1) . "em;'></div></div>";
+                               echo "\n<div class='references' title='" . h($target_name) . "' id='refs$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$source]["pos"] . "em; padding-top: .5em;'>"
+                                       . "<div style='border-top: 1px solid Gray; width: " . (-$left1) . "em;'></div></div>"
+                               ;
                        }
                }
        }
@@ -84,7 +86,8 @@ foreach ($schema as $name => $table) {
                        $left1 = $left - $table_pos[$name][1];
                        $i = 0;
                        foreach ($columns as $target) {
-                               echo "\n<div class='references' title='" . h($target_name) . "' id='refd$left-" . ($i++) . "' style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(../adminer/static/arrow.gif) no-repeat right center;'>"
+                               echo "\n<div class='references' title='" . h($target_name) . "' id='refd$left-" . ($i++) . "'"
+                                       . " style='left: $left1" . "em; top: " . $table["fields"][$target]["pos"] . "em; height: 1.25em; background: url(../adminer/static/arrow.gif) no-repeat right center;'>"
                                        . "<div style='height: .5em; border-bottom: 1px solid Gray; width: " . (-$left1) . "em;'></div>"
                                        . "</div>"
                                ;
index f3f388a112581e3873cf11fcc713fb8c4c231efb..eda00fbbc57f766f4500540ef42459f83add9fe1 100644 (file)
@@ -45,7 +45,11 @@ if (!is_view($table_status)) {
                        foreach ($foreign_keys as $name => $foreign_key) {
                                echo "<tr title='" . h($name) . "'>";
                                echo "<th><i>" . implode("</i>, <i>", array_map('Adminer\h', $foreign_key["source"])) . "</i>";
-                               echo "<td><a href='" . h($foreign_key["db"] != "" ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME) : ($foreign_key["ns"] != "" ? preg_replace('~ns=[^&]*~', "ns=" . urlencode($foreign_key["ns"]), ME) : ME)) . "table=" . urlencode($foreign_key["table"]) . "'>"
+                               $link = ($foreign_key["db"] != ""
+                                       ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME)
+                                       : ($foreign_key["ns"] != "" ? preg_replace('~ns=[^&]*~', "ns=" . urlencode($foreign_key["ns"]), ME) : ME)
+                               );
+                               echo "<td><a href='" . h($link . "table=" . urlencode($foreign_key["table"])) . "'>"
                                        . ($foreign_key["db"] != "" && $foreign_key["db"] != DB ? "<b>" . h($foreign_key["db"]) . "</b>." : "")
                                        . ($foreign_key["ns"] != "" && $foreign_key["ns"] != $_GET["ns"] ? "<b>" . h($foreign_key["ns"]) . "</b>." : "")
                                        . h($foreign_key["table"])
index 8dd5028985533a1efb14bd6e3d38e01684747fe8..07e3d61ef145a45536d1528ef057ef4fec8e9e32 100644 (file)
@@ -148,7 +148,10 @@ echo "<table class='odds'>\n";
 echo "<thead><tr><th colspan='2'>" . lang('Privileges') . doc_link(array('sql' => "grant.html#priv_level"));
 $i = 0;
 foreach ($grants as $object => $grant) {
-       echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
+       echo '<th>' . ($object != "*.*"
+               ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>"
+               : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"
+       ); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
        $i++;
 }
 echo "</thead>\n";
index 0c5c5351607638b8915973c0e219ad3d502cca7a..bc76b8a122fdf425d79554f65aebea3cf948de7a 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -12,8 +12,6 @@
        <rule ref="PSR12">
                <exclude name="Generic.Whitespace.DisallowTabIndent"/><!-- Replaced by: Generic.Whitespace.DisallowSpaceIndent -->
                <exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
-               <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/>
-               <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/>
                <exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses"/>
                <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/><!-- Replaced by: Generic.Classes.OpeningBraceSameLine -->
                <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
@@ -24,6 +22,8 @@
                <!-- More readable. -->
                <exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
                <exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
+               <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceBefore"/>
+               <exclude name="PSR12.Operators.OperatorSpacing.NoSpaceAfter"/>
                <exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
 
                <!-- Saves bytes. -->
@@ -45,7 +45,7 @@
 
        <rule ref="Generic.Files.LineLength">
                <properties>
-                       <property name="lineLimit" value="310"/>
+                       <property name="lineLimit" value="250"/>
                </properties>
                <exclude-pattern>adminer/lang/</exclude-pattern>
        </rule>
index 7fee09eecf36202ba85af9d8d1c815b85b159980..c0476e28e36c6846da92b363b637d98dea767ad8 100644 (file)
@@ -143,7 +143,12 @@ if (isset($_GET["clickhouse"])) {
                function __construct($connection) {
                        parent::__construct($connection);
                        $this->types = array( //! arrays
-                               lang('Numbers') => array("Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19, "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20, "Float32" => 7, "Float64" => 16, 'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38),
+                               lang('Numbers') => array(
+                                       "Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19,
+                                       "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20,
+                                       "Float32" => 7, "Float64" => 16,
+                                       'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38,
+                               ),
                                lang('Date and time') => array("Date" => 13, "DateTime" => 20),
                                lang('Strings') => array("String" => 0),
                                lang('Binary') => array("FixedString" => 0),
index 8c0d68849e700971115e3abd6c72ff03bf6c53df..1dd21ef133b2b5e576985d8030c55af3530f3c98 100644 (file)
@@ -74,7 +74,10 @@ SELECT @adminer_alter;
                        } else {
                                echo substr_replace($create, " IF NOT EXISTS", 12, 0) . ";\n\n";
                                // create procedure which iterates over original columns and adds new and removes old
-                               $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . Adminer\q($table) . " ORDER BY ORDINAL_POSITION";
+                               $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT
+FROM information_schema.COLUMNS
+WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . Adminer\q($table) . "
+ORDER BY ORDINAL_POSITION";
                                echo "DELIMITER ;;
 CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
        DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
index 939a53e725501c9f30e6b4d96f16f2270d39ef87..eac99cc99f1979376c2cc5319457de1a92056d96 100644 (file)
@@ -14,12 +14,18 @@ class AdminerForeignSystem {
                                "columns_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
                                "db" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
                                "help_category" => array(array("table" => "help_category", "source" => array("parent_category_id"), "target" => array("help_category_id"))),
-                               "help_relation" => array(array("table" => "help_topic", "source" => array("help_topic_id"), "target" => array("help_topic_id")), array("table" => "help_keyword", "source" => array("help_keyword_id"), "target" => array("help_keyword_id"))),
+                               "help_relation" => array(
+                                       array("table" => "help_topic", "source" => array("help_topic_id"), "target" => array("help_topic_id")),
+                                       array("table" => "help_keyword", "source" => array("help_keyword_id"), "target" => array("help_keyword_id")),
+                               ),
                                "help_topic" => array(array("table" => "help_category", "source" => array("help_category_id"), "target" => array("help_category_id"))),
                                "procs_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User")), array("table" => "proc", "source" => array("Db", "Routine_name"), "target" => array("db", "name"))),
                                "tables_priv" => array(array("table" => "user", "source" => array("Host", "User"), "target" => array("Host", "User"))),
                                "time_zone_name" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id"))),
-                               "time_zone_transition" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")), array("table" => "time_zone_transition_type", "source" => array("Time_zone_id", "Transition_type_id"), "target" => array("Time_zone_id", "Transition_type_id"))),
+                               "time_zone_transition" => array(
+                                       array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id")),
+                                       array("table" => "time_zone_transition_type", "source" => array("Time_zone_id", "Transition_type_id"), "target" => array("Time_zone_id", "Transition_type_id")),
+                               ),
                                "time_zone_transition_type" => array(array("table" => "time_zone", "source" => array("Time_zone_id"), "target" => array("Time_zone_id"))),
                        );
                        return $return[$table];
index fd0428ec9a2b352d8214f9fcf703e4a5592345ea..a2ef3d4ae65535ccff5f456970e813dca1dbde9a 100644 (file)
@@ -15,7 +15,15 @@ class AdminerTableStructure {
        function tableStructurePrint($fields) {
                echo "<div class='scrollable'>\n";
                echo "<table class='nowrap odds'>\n";
-               echo "<thead><tr><th>" . Adminer\lang('Column') . "<th>" . Adminer\lang('Type') . "<th>" . Adminer\lang('Collation') . "<th>" . Adminer\lang('Nullable') . "<th>" . Adminer\lang('Default') . (Adminer\support("comment") ? "<th>" . Adminer\lang('Comment') : "") . "</thead>\n";
+               echo "<thead><tr>"
+                       . "<th>" . Adminer\lang('Column')
+                       . "<th>" . Adminer\lang('Type')
+                       . "<th>" . Adminer\lang('Collation')
+                       . "<th>" . Adminer\lang('Nullable')
+                       . "<th>" . Adminer\lang('Default')
+                       . (Adminer\support("comment") ? "<th>" . Adminer\lang('Comment') : "")
+                       . "</thead>\n"
+               ;
                foreach ($fields as $field) {
                        echo "<tr><th>" . Adminer\h($field["field"]) . ($field["primary"] ? " (PRIMARY)" : "");
                        echo "<td><span>" . Adminer\h($field["full_type"]) . "</span>";