]> git.joonet.de Git - adminer.git/commitdiff
Allow bigger numbers under 32 bits
authorJakub Vrana <jakub@vrana.cz>
Fri, 22 Oct 2010 21:36:56 +0000 (23:36 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 22 Oct 2010 21:36:56 +0000 (23:36 +0200)
adminer/call.inc.php
adminer/create.inc.php
adminer/edit.inc.php
adminer/foreign.inc.php
adminer/include/functions.inc.php
adminer/indexes.inc.php
adminer/select.inc.php

index 5c1ba945351ae9ae61ff0f65383b1a0fb801c647..0407474b2129b481e7185c1fa35df0a50e61d7fe 100644 (file)
@@ -58,7 +58,7 @@ if ($in) {
                echo "<tr><th>" . $adminer->fieldName($field);
                $value = $_POST["fields"][$name];
                if ($value != "" && ereg("enum|set", $field["type"])) {
-                       $value = intval($value);
+                       $value = +$value;
                }
                input($field, $value, (string) $_POST["function"][$name]); // param name can be empty
                echo "\n";
index fcce1e2845c08027e65adbbcba884cc1e117f459..92091dd52dba7de38149880a57c12ba89f3c68ba 100644 (file)
@@ -65,7 +65,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
                        }
                        $partitioning .= "\nPARTITION BY $_POST[partition_by]($_POST[partition])" . ($partitions // $_POST["partition"] can be expression, not only column
                                ? " (" . implode(",", $partitions) . "\n)"
-                               : ($_POST["partitions"] ? " PARTITIONS " . intval($_POST["partitions"]) : "")
+                               : ($_POST["partitions"] ? " PARTITIONS " . (+$_POST["partitions"]) : "")
                        );
                } elseif ($TABLE != "" && support("partitioning")) {
                        $partitioning .= "\nREMOVE PARTITIONING";
index 298725ed73df635ee98d16f2bfc0d8897115389a..653d3f4d520c7a1394be506a682ddccb317c3a51 100644 (file)
@@ -72,7 +72,7 @@ if ($fields) {
                echo "<tr><th>" . $adminer->fieldName($field);
                $default = $_GET["set"][bracket_escape($name)];
                $value = (isset($row)
-                       ? ($row[$name] != "" && ereg("enum|set", $field["type"]) ? intval($row[$name]) : $row[$name])
+                       ? ($row[$name] != "" && ereg("enum|set", $field["type"]) ? +$row[$name] : $row[$name])
                        : (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : (isset($default) ? $default : $field["default"])))
                );
                if (!$_POST["save"] && is_string($value)) {
index 801586ef89e88cf4a3814181ca295ec263e920b6..f6e84f9d9af2fe6266b696a8e636bd14ac75a21a 100644 (file)
@@ -60,8 +60,8 @@ foreach (table_status() as $name => $table_status) {
 $j = 0;
 foreach ($row["source"] as $key => $val) {
        echo "<tr>";
-       echo "<td>" . html_select("source[" . intval($key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1));
-       echo "<td>" . html_select("target[" . intval($key) . "]", $target, $row["target"][$key]);
+       echo "<td>" . html_select("source[" . (+$key) . "]", array(-1 => "") + $source, $val, ($j == count($row["source"]) - 1 ? "foreignAddRow(this);" : 1));
+       echo "<td>" . html_select("target[" . (+$key) . "]", $target, $row["target"][$key]);
        $j++;
 }
 ?>
index ff9ef98ab8b9c3253d71fbfe99ee8e4f0742c9cb..1331e5f34feadc2e9666c1964ca7ff1f46851a0b 100644 (file)
@@ -640,7 +640,7 @@ function process_input($field) {
                if ($value == "") {
                        return "NULL";
                }
-               return intval($value);
+               return +$value;
        }
        if ($field["auto_increment"] && $value == "") {
                return null;
index afb91270307ea7630ed16a8b0b9c1d6d2024ec61..090d86afe7cde7cf32346735eccf3ff482b6fb34 100644 (file)
@@ -21,7 +21,7 @@ if ($_POST && !$error && !$_POST["add"]) {
                        foreach ($index["columns"] as $key => $column) {
                                if ($column != "") {
                                        $length = $index["lengths"][$key];
-                                       $set[] = idf_escape($column) . ($length ? "(" . intval($length) . ")" : "");
+                                       $set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "");
                                        $columns[] = $column;
                                        $lengths[] = ($length ? $length : null);
                                }
index 9edc14ccf6f128898935bea533569887e5a44e1e..e0ae7875bf462c12d1658215233ce02850099492 100644 (file)
@@ -212,7 +212,7 @@ if (!$columns) {
                $page = floor(max(0, $found_rows - 1) / $limit);
        }
 
-       $query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0), "\n");
+       $query = "SELECT" . limit((+$limit && $group && count($group) < count($select) && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from, ($where ? "\nWHERE " . implode(" AND ", $where) : "") . $group_by, ($limit != "" ? +$limit : null), ($page ? $limit * $page : 0), "\n");
        echo $adminer->selectQuery($query);
        
        $result = $connection->query($query);
@@ -230,7 +230,7 @@ if (!$columns) {
                }
                // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
                if ($_GET["page"] != "last") {
-                       $found_rows = (intval($limit) && $group && count($group) < count($select)
+                       $found_rows = (+$limit && $group && count($group) < count($select)
                                ? ($jush == "sql" ? $connection->result(" SELECT FOUND_ROWS()") : $connection->result("SELECT COUNT(*) FROM ($query) x")) // space to allow mysql.trace_mode
                                : count($rows)
                        );
@@ -292,7 +292,7 @@ if (!$columns) {
                                                        if ($val == "") {
                                                                $val = "&nbsp;";
                                                        } elseif ($text_length != "" && ereg('text|blob', $field["type"]) && is_utf8($val)) {
-                                                               $val = shorten_utf8($val, max(0, intval($text_length))); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network
+                                                               $val = shorten_utf8($val, max(0, +$text_length)); // usage of LEFT() would reduce traffic but complicate query - expected average speedup: .001 s VS .01 s on local network
                                                        } else {
                                                                $val = h($val);
                                                        }
@@ -354,7 +354,7 @@ if (!$columns) {
                
                if ($rows || $page) {
                        $exact_count = true;
-                       if ($_GET["page"] != "last" && intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
+                       if ($_GET["page"] != "last" && +$limit && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
                                $found_rows = $table_status["Rows"];
                                if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) {
                                        // slow with big tables
@@ -366,7 +366,7 @@ if (!$columns) {
                                }
                        }
                        echo "<p class='pages'>";
-                       if (intval($limit) && $found_rows > $limit) {
+                       if (+$limit && $found_rows > $limit) {
                                // display first, previous 4, next 4 and last page
                                $max_page = floor(($found_rows - 1) / $limit);
                                echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"var page = +prompt('" . lang('Page') . "', '" . ($page + 1) . "'); if (!isNaN(page) &amp;&amp; page) location.href = this.href + (page != 1 ? '&amp;page=' + (page - 1) : ''); return false;\">" . lang('Page') . "</a>:" . pagination(0, $page) . ($page > 5 ? " ..." : "");