mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 23:27:17 +02:00
SQLite: Fix expressions in default values (bug #860)
This commit is contained in:
@@ -319,7 +319,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
"field" => $name,
|
||||
"type" => (preg_match('~int~i', $type) ? "integer" : (preg_match('~char|clob|text~i', $type) ? "text" : (preg_match('~blob~i', $type) ? "blob" : (preg_match('~real|floa|doub~i', $type) ? "real" : "numeric")))),
|
||||
"full_type" => $type,
|
||||
"default" => (preg_match("~'(.*)'~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)),
|
||||
"default" => (preg_match("~^'(.*)'$~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)),
|
||||
"null" => !$row["notnull"],
|
||||
"privileges" => array("select" => 1, "insert" => 1, "update" => 1),
|
||||
"primary" => $row["pk"],
|
||||
|
@@ -294,10 +294,11 @@ function process_field($field, $type_field) {
|
||||
* @return string
|
||||
*/
|
||||
function default_value($field) {
|
||||
global $jush;
|
||||
$default = $field["default"];
|
||||
return ($default === null ? "" : " DEFAULT " .
|
||||
(!preg_match('~^GENERATED ~i', $default) && (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default))
|
||||
? q($default) : str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $default))
|
||||
? q($default) : str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", ($jush == "sqlite" ? "($default)" : $default)))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@ MySQL: Fix saving bit(64) values (bug #839)
|
||||
PostgreSQL: Preserve whitespace in EXPLAIN (bug #827)
|
||||
PostgreSQL: Support SSL
|
||||
SQLite: Fix altering forign keys (bug #841)
|
||||
SQLite: Fix expressions in default values (bug #860)
|
||||
MS SQL: Foreign keys in non-default schema (bug #833)
|
||||
Oracle: Include tables granted by other user
|
||||
MongoDB: Execute commands against the selected DB
|
||||
|
Reference in New Issue
Block a user