PostgreSQL bool in Editor
This commit is contained in:
parent
ebc0c52f5f
commit
2dbc73833b
|
@ -170,13 +170,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||||
$return = "<img src='$link' alt='$return'>";
|
$return = "<img src='$link' alt='$return'>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && $return != " ") { // bool
|
if (like_bool($field) && $return != " ") { // bool
|
||||||
$return = '<img src="' . ($val ? "../adminer/static/plus.gif" : "../adminer/static/cross.gif") . '" alt="' . h($val) . '">';
|
$return = '<img src="' . ($val ? "../adminer/static/plus.gif" : "../adminer/static/cross.gif") . '" alt="' . h($val) . '">';
|
||||||
}
|
}
|
||||||
if ($link) {
|
if ($link) {
|
||||||
$return = "<a href='$link'>$return</a>";
|
$return = "<a href='$link'>$return</a>";
|
||||||
}
|
}
|
||||||
if (!$link && !ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && ereg('int|float|double|decimal', $field["type"])) {
|
if (!$link && !like_bool($field) && ereg('int|float|double|decimal', $field["type"])) {
|
||||||
$return = "<div class='number'>$return</div>"; // Firefox doesn't support <colgroup>
|
$return = "<div class='number'>$return</div>"; // Firefox doesn't support <colgroup>
|
||||||
} elseif (ereg('date', $field["type"])) {
|
} elseif (ereg('date', $field["type"])) {
|
||||||
$return = "<div class='datetime'>$return</div>";
|
$return = "<div class='datetime'>$return</div>";
|
||||||
|
@ -411,7 +411,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||||
if ($field["null"] && ereg('blob', $field["type"])) {
|
if ($field["null"] && ereg('blob', $field["type"])) {
|
||||||
$return["NULL"] = lang('empty');
|
$return["NULL"] = lang('empty');
|
||||||
}
|
}
|
||||||
$return[""] = ($field["null"] || $field["auto_increment"] || ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) ? "" : "*");
|
$return[""] = ($field["null"] || $field["auto_increment"] || like_bool($field) ? "" : "*");
|
||||||
//! respect driver
|
//! respect driver
|
||||||
if (ereg('date|time', $field["type"])) {
|
if (ereg('date|time', $field["type"])) {
|
||||||
$return["now"] = lang('now');
|
$return["now"] = lang('now');
|
||||||
|
@ -432,7 +432,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||||
if ($options) {
|
if ($options) {
|
||||||
return "<select$attrs>" . optionlist($options, $value, true) . "</select>";
|
return "<select$attrs>" . optionlist($options, $value, true) . "</select>";
|
||||||
}
|
}
|
||||||
if (ereg("(tinyint|bit)\\(1\\)", $field["full_type"])) { // bool
|
if (like_bool($field)) {
|
||||||
return '<input type="checkbox" value="' . h($value ? $value : 1) . '"' . ($value ? ' checked' : '') . "$attrs>";
|
return '<input type="checkbox" value="' . h($value ? $value : 1) . '"' . ($value ? ' checked' : '') . "$attrs>";
|
||||||
}
|
}
|
||||||
$hint = "";
|
$hint = "";
|
||||||
|
@ -460,7 +460,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||||
$return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
|
$return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
|
||||||
}
|
}
|
||||||
$return = ($field["type"] == "bit" && ereg('^[0-9]+$', $value) ? $return : q($return));
|
$return = ($field["type"] == "bit" && ereg('^[0-9]+$', $value) ? $return : q($return));
|
||||||
if (!ereg('char|text', $field["type"]) && !ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && $value == "") {
|
if (!ereg('char|text', $field["type"]) && !like_bool($field) && $value == "") {
|
||||||
$return = "NULL";
|
$return = "NULL";
|
||||||
} elseif (ereg('^(md5|sha1)$', $function)) {
|
} elseif (ereg('^(md5|sha1)$', $function)) {
|
||||||
$return = "$function($return)";
|
$return = "$function($return)";
|
||||||
|
|
|
@ -43,3 +43,11 @@ function send_mail($email, $subject, $message, $from = "", $files = array("error
|
||||||
;
|
;
|
||||||
return mail($email, email_header($subject), $beginning . $message . $attachments, $headers);
|
return mail($email, email_header($subject), $beginning . $message . $attachments, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check whether the column looks like boolean
|
||||||
|
* @param array single field returned from fields()
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function like_bool($field) {
|
||||||
|
return ereg("bool|(tinyint|bit)\\(1\\)", $field["full_type"]);
|
||||||
|
}
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -38,7 +38,6 @@ Users - SELECT * FROM pg_user
|
||||||
ORDER BY COUNT(*)
|
ORDER BY COUNT(*)
|
||||||
Export - http://www.postgresql.org/docs/8.4/static/functions-info.html
|
Export - http://www.postgresql.org/docs/8.4/static/functions-info.html
|
||||||
Column rights - http://www.postgresql.org/docs/8.4/static/functions-info.html
|
Column rights - http://www.postgresql.org/docs/8.4/static/functions-info.html
|
||||||
bool in Editor
|
|
||||||
|
|
||||||
MS SQL:
|
MS SQL:
|
||||||
Display default value
|
Display default value
|
||||||
|
|
Loading…
Reference in a new issue