|
@@ -84,8 +84,7 @@ discard block |
|
|
block discarded – undo |
|
84
|
84
|
"text" : (preg_match('~blob~i', $type) ? "blob" : (preg_match('~real|floa|doub~i', $type) ? |
|
85
|
85
|
"real" : "numeric")))); |
|
86
|
86
|
$field->fullType = $type; |
|
87
|
|
- $field->default = (preg_match("~'(.*)'~", $default, $match) ? str_replace("''", "'", $match[1]) : |
|
88
|
|
- ($default == "NULL" ? null : $default)); |
|
|
87
|
+ $field->default = (preg_match("~'(.*)'~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)); |
|
89
|
88
|
$field->null = !$row["notnull"]; |
|
90
|
89
|
$field->privileges = ["select" => 1, "insert" => 1, "update" => 1]; |
|
91
|
90
|
$field->primary = $row["pk"]; |
|
@@ -327,7 +326,7 @@ discard block |
|
|
block discarded – undo |
|
327
|
326
|
if ($originals && !$this->driver->execute("INSERT INTO " . $this->driver->table($tempName) . |
|
328
|
327
|
" (" . implode(", ", $originals) . ") SELECT " . implode( |
|
329
|
328
|
", ", |
|
330
|
|
- array_map(function ($key) { |
|
|
329
|
+ array_map(function($key) { |
|
331
|
330
|
return $this->driver->escapeId($key); |
|
332
|
331
|
}, array_keys($originals)) |
|
333
|
332
|
) . " FROM " . $this->driver->table($table))) { |
|
@@ -339,8 +338,7 @@ discard block |
|
|
block discarded – undo |
|
339
|
338
|
$triggers[] = "CREATE TRIGGER " . $this->driver->escapeId($trigger_name) . " " . |
|
340
|
339
|
implode(" ", $timing_event) . " ON " . $this->driver->table($name) . "\n$trigger[Statement]"; |
|
341
|
340
|
} |
|
342
|
|
- $autoIncrement = $autoIncrement ? 0 : |
|
343
|
|
- $this->connection->result("SELECT seq FROM sqlite_sequence WHERE name = " . |
|
|
341
|
+ $autoIncrement = $autoIncrement ? 0 : $this->connection->result("SELECT seq FROM sqlite_sequence WHERE name = " . |
|
344
|
342
|
$this->driver->quote($table)); // if $autoIncrement is set then it will be updated later |
|
345
|
343
|
// drop before creating indexes and triggers to allow using old names |
|
346
|
344
|
if (!$this->driver->execute("DROP TABLE " . $this->driver->table($table)) || |
|
@@ -374,8 +372,7 @@ discard block |
|
|
block discarded – undo |
|
374
|
372
|
} |
|
375
|
373
|
foreach (array_reverse($alter) as $val) { |
|
376
|
374
|
if (!$this->driver->execute($val[2] == "DROP" ? |
|
377
|
|
- "DROP INDEX " . $this->driver->escapeId($val[1]) : |
|
378
|
|
- $this->driver->sqlForCreateIndex($table, $val[0], $val[1], "(" . implode(", ", $val[2]) . ")") |
|
|
375
|
+ "DROP INDEX " . $this->driver->escapeId($val[1]) : $this->driver->sqlForCreateIndex($table, $val[0], $val[1], "(" . implode(", ", $val[2]) . ")") |
|
379
|
376
|
)) { |
|
380
|
377
|
return false; |
|
381
|
378
|
} |