]> git.joonet.de Git - adminer.git/commitdiff
Save bytes
authorJakub Vrana <jakub@vrana.cz>
Mon, 11 Jul 2011 14:35:17 +0000 (16:35 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 11 Jul 2011 14:35:17 +0000 (16:35 +0200)
adminer/drivers/mysql.inc.php
adminer/include/editing.inc.php
adminer/index.php
adminer/procedure.inc.php

index 57e1be02fc7eb6827eba82be0d9d5473f65fbf73..df617f0fbbfca8c68d8aa9a3c6dfa19f7248428d 100644 (file)
@@ -729,7 +729,7 @@ if (!defined("DRIVER")) {
                global $connection, $enum_length, $inout, $types;
                $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar");
                $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
-               $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
+               $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
                $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2);
                preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match);
                $fields = array();
index 931f8dc846187f6ff91e63cab5d994c0409f770a..a058de9238ed84c2435bc13a6f0461beaa787ea7 100644 (file)
@@ -234,7 +234,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
                $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]", $inout, $field["inout"]) : ""); ?>
+<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
 <th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo ($field["field"] != "" || count($fields) > 1 ? "" : "editingAddRow(this, $allowed); "); ?>editingNameChange(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
 <?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
 <?php if ($type == "TABLE") { ?>
index cf3c1a6a1a68715e0263e7228b683784b470dcea..dd667f345ccb9eeaff246b7e0f9b60c910433150 100644 (file)
@@ -10,7 +10,7 @@
 include "./include/bootstrap.inc.php";
 
 $enum_length = "'(?:''|[^'\\\\]|\\\\.)*+'";
-$inout = array("IN", "OUT", "INOUT");
+$inout = "IN|OUT|INOUT";
 
 if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) {
        $_GET["edit"] = $_GET["select"];
index d75c37d3bfb376c4ae10963fe1afb92361a2c554..5f767246b84e3f579ee3d5337b15df2d1b3d3d58 100644 (file)
@@ -10,7 +10,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
        ksort($fields); // enforce fields order
        foreach ($fields as $field) {
                if ($field["field"] != "") {
-                       $set[] = (in_array($field["inout"], $inout) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
+                       $set[] = (ereg("^($inout)\$", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
                }
        }
        $dropped = drop_create(