]> git.joonet.de Git - adminer.git/commitdiff
Wrap long lines
authorJakub Vrana <jakub@vrana.cz>
Thu, 20 Feb 2025 16:58:00 +0000 (17:58 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 20 Feb 2025 16:58:00 +0000 (17:58 +0100)
adminer/drivers/mssql.inc.php
adminer/drivers/pgsql.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/select.inc.php
plugins/dump-alter.php

index 347526290a28e776d57ef07655048d7f5d669dab..de733073b3af0557ec866cff203b34e28288160e 100644 (file)
@@ -363,7 +363,9 @@ if (isset($_GET["mssql"])) {
 
        function table_status($name = "") {
                $return = array();
-               foreach (get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment FROM sys.all_objects AS ao WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
+               foreach (get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment
+FROM sys.all_objects AS ao
+WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
                        if ($name != "") {
                                return $row;
                        }
index a450380f4de01d76f2263094944b6305e4bbeb46..eb40104fc68824ed6cda03d811dc33891fe8f62f 100644 (file)
@@ -333,7 +333,15 @@ ORDER BY 1";
 
        function table_status($name = "") {
                $return = array();
-               foreach (get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_table_size(c.oid) AS \"Data_length\", pg_indexes_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", " . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\", c.reltuples as \"Rows\", n.nspname
+               foreach (get_rows("SELECT
+       c.relname AS \"Name\",
+       CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\",
+       pg_table_size(c.oid) AS \"Data_length\",
+       pg_indexes_size(c.oid) AS \"Index_length\",
+       obj_description(c.oid, 'pg_class') AS \"Comment\",
+       " . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\",
+       c.reltuples as \"Rows\",
+       n.nspname
 FROM pg_class c
 JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
 WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
index d4d2dae52ed10b79c9b26e016370f3b4d1b82e01..b883faf008b833af30c78612337b44920b453508 100644 (file)
@@ -219,10 +219,18 @@ if ($foreign_keys) {
        $structured_types[lang('Foreign keys')] = $foreign_keys;
 }
 echo optionlist(array_merge($extra_types, $structured_types), $type);
-?></select><td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" 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
+?></select><td><input
+       name="<?php echo h($key); ?>[length]"
+       value="<?php echo h($field["length"]); ?>"
+       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 "<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 (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 (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("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
 }
 
index 9cb45133976b9ed798c672e783867bcb6a3eff65..61fbe1d1608167dbaa014075b01dda8581a49d66 100644 (file)
@@ -954,7 +954,10 @@ function input($field, $value, $function) {
                        echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>';
                } else {
                        // int(3) is only a display hint
-                       $maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match) ? ((preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
+                       $maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match)
+                               ? ((preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0))
+                               : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)
+                       );
                        if ($jush == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
                                $maxlength += 7; // microtime
                        }
index bda6b1f294834194df1bfb187e17ccdf480cd55e..aec57ccae7c75ef6c698e97ff81128704cbce3db 100644 (file)
@@ -529,7 +529,9 @@ if (!$columns && support("table")) {
                                echo "<fieldset>";
                                echo "<legend>" . lang('Whole result') . "</legend>";
                                $display_rows = ($exact_count ? "" : "~ ") . $found_rows;
-                               echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""), "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);") . "\n";
+                               echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""),
+                                       "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);"
+                               ) . "\n";
                                echo "</fieldset>\n";
 
                                if ($adminer->selectCommandPrint()) {
index 8bfa466d14ad736e3c949fc0c293e2a6626feceb..50e9b694e05eb8cff4ffba2170b6b3a9fcacd34b 100644 (file)
@@ -118,7 +118,13 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
                                        echo "
                                WHEN " . q($row["COLUMN_NAME"]) . " THEN
                                        SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF(
-                                               _column_default <=> $row[default] AND _is_nullable = '$row[IS_NULLABLE]' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . " AND _column_type = " . q($row["COLUMN_TYPE"]) . " AND _extra = '$row[EXTRA]' AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " AND after = $row[after]
+                                               _column_default <=> $row[default]
+                                               AND _is_nullable = '$row[IS_NULLABLE]'
+                                               AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . "
+                                               AND _column_type = " . q($row["COLUMN_TYPE"]) . "
+                                               AND _extra = '$row[EXTRA]'
+                                               AND _column_comment = " . q($row["COLUMN_COMMENT"]) . "
+                                               AND after = $row[after]
                                        , '', ', MODIFY $row[alter]'));"; //! don't replace in comment
                                }
                                echo "