Permalink
Browse files

Fix handling of POINT data type (bug #3582578)

  • Loading branch information...
1 parent 0f47ae8 commit 741cd5b4b69392e977ca04ed17ce5005c4ea6371 @vrana committed Apr 26, 2013
Showing with 6 additions and 5 deletions.
  1. +2 −2 adminer/include/adminer.inc.php
  2. +2 −2 adminer/include/editing.inc.php
  3. +1 −1 adminer/static/editing.js
  4. +1 −0 changes.txt
@@ -414,7 +414,7 @@ function selectSearchProcess($fields, $indexes) {
$cols = array();
foreach ($fields as $name => $field) {
$is_text = ereg('char|text|enum|set', $field["type"]);
- if ((is_numeric($val["val"]) || !ereg('int|float|double|decimal|bit', $field["type"]))
+ if ((is_numeric($val["val"]) || !ereg('(^|[^o])int|float|double|decimal|bit', $field["type"]))
&& (!ereg("[\x80-\xFF]", $val["val"]) || $is_text)
) {
$name = idf_escape($name);
@@ -661,7 +661,7 @@ function dumpData($table, $style, $query) {
}
foreach ($row as $key => $val) {
$row[$key] = ($val !== null
- ? (ereg('int|float|double|decimal|bit', $fields[$keys[$key]]["type"]) && $val != '' ? $val : q($val)) //! columns looking like functions
+ ? (ereg('(^|[^o])int|float|double|decimal|bit', $fields[$keys[$key]]["type"]) && $val != '' ? $val : q($val)) //! columns looking like functions
: "NULL"
);
}
@@ -151,7 +151,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist((!$field["type"] || isset($types[$field["type"]]) ? array() : array($field["type"])) + $structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td class="options"><?php //! type="number" with enabled JavaScript
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
- echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
+ echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('((^|[^o])int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
echo (isset($field['on_update']) ? "<select name='$key" . "[on_update]'" . ($field["type"] == "timestamp" ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
echo ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (ereg("`", $field["type"]) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
}
@@ -174,7 +174,7 @@ function process_type($field, $collate = "COLLATE") {
global $unsigned;
return " $field[type]"
. ($field["length"] != "" ? "(" . process_length($field["length"]) . ")" : "")
- . (ereg('int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
+ . (ereg('(^|[^o])int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (ereg('char|text|enum|set', $field["type"]) && $field["collation"] ? " $collate " . q($field["collation"]) : "")
;
}
@@ -363,7 +363,7 @@ function editingTypeChange(type) {
el.className = (/(char|text|enum|set)$/.test(text) ? '' : 'hidden');
}
if (el.name == name + '[unsigned]') {
- el.className = (/(int|float|double|decimal)$/.test(text) ? '' : 'hidden');
+ el.className = (/((^|[^o])int|float|double|decimal)$/.test(text) ? '' : 'hidden');
}
if (el.name == name + '[on_update]') {
el.className = (text == 'timestamp' ? '' : 'hidden');
View
@@ -1,5 +1,6 @@
Adminer 3.6.5-dev:
Print run time next to executed queries
+Fix handling of POINT data type (bug #3582578)
Adminer 3.6.4 (released 2013-04-26):
Display pagination on a fixed position

0 comments on commit 741cd5b

Please sign in to comment.