SQLite: Allow setting auto increment for empty tables
This commit is contained in:
parent
48f33f6255
commit
903de0e889
|
@ -482,6 +482,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
|
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
|
||||||
|
global $connection;
|
||||||
$use_all_fields = ($table == "" || $foreign);
|
$use_all_fields = ($table == "" || $foreign);
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
if ($field[0] != "" || !$field[1] || $field[2]) {
|
if ($field[0] != "" || !$field[1] || $field[2]) {
|
||||||
|
@ -512,7 +513,12 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($auto_increment) {
|
if ($auto_increment) {
|
||||||
|
queries("BEGIN");
|
||||||
queries("UPDATE sqlite_sequence SET seq = $auto_increment WHERE name = " . q($name)); // ignores error
|
queries("UPDATE sqlite_sequence SET seq = $auto_increment WHERE name = " . q($name)); // ignores error
|
||||||
|
if (!$connection->affected_rows) {
|
||||||
|
queries("INSERT INTO sqlite_sequence (name, seq) VALUES (" . q($name) . ", $auto_increment)");
|
||||||
|
}
|
||||||
|
queries("COMMIT");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ MySQL: Allow editing rows identified by negative floats (bug #695)
|
||||||
MySQL: Skip editing generated columns
|
MySQL: Skip editing generated columns
|
||||||
SQLite: Quote strings stored in integer columns in export (bug #696)
|
SQLite: Quote strings stored in integer columns in export (bug #696)
|
||||||
SQLite: Handle error in altering table (bug #697)
|
SQLite: Handle error in altering table (bug #697)
|
||||||
|
SQLite: Allow setting auto increment for empty tables
|
||||||
|
|
||||||
Adminer 4.7.2 (released 2019-07-18):
|
Adminer 4.7.2 (released 2019-07-18):
|
||||||
Do not attempt logging in without password (bug #676)
|
Do not attempt logging in without password (bug #676)
|
||||||
|
|
Loading…
Reference in a new issue