return array();
}
+ function convert_field($field) {
+ }
+
+ function unconvert_field($field, $return) {
+ return $return;
+ }
+
function support($feature) {
return ereg('^(scheme|trigger|view|drop_col)$', $feature); //! routine|
}
return get_key_vals("SHOW STATUS");
}
+ /** Convert field in select and edit
+ * @param array one element from fields()
+ * @return string
+ */
+ function convert_field($field) {
+ if (ereg("binary", $field["type"])) {
+ return "HEX(" . idf_escape($field["field"]) . ")";
+ }
+ if (ereg("geometry|point|linestring|polygon", $field["type"])) {
+ return "AsWKT(" . idf_escape($field["field"]) . ")";
+ }
+ }
+
+ /** Convert value in edit after applying functions back
+ * @param array one element from fields()
+ * @param string
+ * @return string
+ */
+ function unconvert_field($field, $return) {
+ if (ereg("binary", $field["type"])) {
+ $return = "unhex($return)";
+ }
+ if (ereg("geometry|point|linestring|polygon", $field["type"])) {
+ $return = "GeomFromText($return)";
+ }
+ return $return;
+ }
+
/** Check whether a feature is supported
* @param string "comment", "copy", "drop_col", "dump", "event", "kill", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "trigger", "type", "variables", "view"
* @return bool
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "mediumint" => 8, "int" => 10, "bigint" => 20, "decimal" => 66, "float" => 12, "double" => 21),
lang('Date and time') => array("date" => 10, "datetime" => 19, "timestamp" => 19, "time" => 10, "year" => 4),
lang('Strings') => array("char" => 255, "varchar" => 65535, "tinytext" => 255, "text" => 65535, "mediumtext" => 16777215, "longtext" => 4294967295),
- lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
lang('Lists') => array("enum" => 65535, "set" => 64),
+ lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
+ lang('Geometry') => array("geometry" => 0, "point" => 0, "linestring" => 0, "polygon" => 0, "multipoint" => 0, "multilinestring" => 0, "multipolygon" => 0, "geometrycollection" => 0),
) as $key => $val) {
$types += $val;
$structured_types[$key] = array_keys($val);
"binary" => "md5/sha1",
"date|time" => "now",
), array(
- "int|float|double|decimal" => "+/-",
+ "(^|[^o])int|float|double|decimal" => "+/-", // not point
"date" => "+ interval/- interval",
"time" => "addtime/subtime",
"char|text" => "concat",
return reset($rows);
}
+ function convert_field($field) {
+ }
+
+ function unconvert_field($field, $return) {
+ return $return;
+ }
+
function support($feature) {
return ereg("view|scheme|processlist|drop_col|variables|status", $feature); //!
}
function show_status() {
}
+ function convert_field($field) {
+ }
+
+ function unconvert_field($field, $return) {
+ return $return;
+ }
+
function support($feature) {
return ereg('^(comment|view|scheme|processlist|sequence|trigger|type|variables|drop_col)$', $feature); //! routine|
}
return $return;
}
+ function convert_field($field) {
+ }
+
+ function unconvert_field($field, $return) {
+ return $return;
+ }
+
function support($feature) {
return ereg('^(view|trigger|variables|status|dump|move_col|drop_col)$', $feature);
}
$select = array();
foreach ($fields as $name => $field) {
if (isset($field["privileges"]["select"])) {
- $select[] = ($_POST["clone"] && $field["auto_increment"] ? "'' AS " : ($jush == "sql" && ereg("enum|set", $field["type"]) ? "1*" . idf_escape($name) . " AS " : "")) . idf_escape($name);
+ $as = convert_field($field);
+ if ($_POST["clone"] && $field["auto_increment"]) {
+ $as = "''";
+ }
+ if ($jush == "sql" && ereg("enum|set", $field["type"])) {
+ $as = "1*" . idf_escape($name);
+ }
+ $select[] = ($as ? "$as AS " : "") . idf_escape($name);
}
}
$row = array();
* @return string
*/
function editVal($val, $field) {
- return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
+ return $val;
}
/** Print columns box in select
} elseif (ereg('^(md5|sha1|password|encrypt)$', $function)) {
$return = "$function($return)";
}
- if (ereg("binary", $field["type"])) {
- $return = "unhex($return)";
- }
- return $return;
+ return unconvert_field($field, $return);
}
/** Returns export output options
$where = $adminer->selectSearchProcess($fields, $indexes);
$order = $adminer->selectOrderProcess($fields, $indexes);
$limit = $adminer->selectLimitProcess();
-$from = ($select ? implode(", ", $select) : ($oid ? "$oid, " : "") . "*") . "\nFROM " . table($TABLE);
+$from = ($select ? implode(", ", $select) : "*" . ($oid ? ", $oid" : ""));
+if ($jush == "sql") {
+ foreach ($columns as $key => $val) {
+ $as = convert_field($fields[$key]);
+ if ($as) {
+ $from .= ", $as AS " . idf_escape($key);
+ }
+ }
+}
+$from .= "\nFROM " . table($TABLE);
$group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
if ($_GET["val"] && is_ajax()) {
Style logout button as link
Store selected database to permanent login
Ctrl+click and Shift+click on button opens form to a blank window
+MySQL: Support geometry data types
Switch language by POST
Compress translations
selectQueryBuild() method (customization)
if (ereg('date|timestamp', $field["type"]) && $val !== null) {
return preg_replace('~^(\\d{2}(\\d+))-(0?(\\d+))-(0?(\\d+))~', lang('$1-$3-$5'), $val);
}
- return (ereg("binary", $field["type"]) ? reset(unpack("H*", $val)) : $val);
+ return $val;
}
function selectColumnsPrint($select, $columns) {
} elseif (ereg('^(md5|sha1)$', $function)) {
$return = "$function($return)";
}
- if (ereg("binary", $field["type"])) {
- $return = "unhex($return)";
- }
- return $return;
+ return unconvert_field($field, $return);
}
function dumpOutput() {
-Subproject commit 1dbb89b3d1f1aa27a067b017af44f4ef498bbaab
+Subproject commit d5d52b19fb783b9ffe138496d14c7fe776b11eb4