mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 16:17:48 +02:00
Allow bigger numbers under 32 bits
This commit is contained in:
@@ -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";
|
||||
|
@@ -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";
|
||||
|
@@ -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)) {
|
||||
|
@@ -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++;
|
||||
}
|
||||
?>
|
||||
|
@@ -640,7 +640,7 @@ function process_input($field) {
|
||||
if ($value == "") {
|
||||
return "NULL";
|
||||
}
|
||||
return intval($value);
|
||||
return +$value;
|
||||
}
|
||||
if ($field["auto_increment"] && $value == "") {
|
||||
return null;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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 = " ";
|
||||
} 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) && page) location.href = this.href + (page != 1 ? '&page=' + (page - 1) : ''); return false;\">" . lang('Page') . "</a>:" . pagination(0, $page) . ($page > 5 ? " ..." : "");
|
||||
|
Reference in New Issue
Block a user