Display auto_increment value of inserted item
This commit is contained in:
parent
22eb69b562
commit
29e7f041a3
|
@ -409,6 +409,11 @@ WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table)
|
|||
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
global $connection;
|
||||
return $connection->result("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT
|
||||
}
|
||||
|
||||
function explain($connection, $query) {
|
||||
$connection->query("SET SHOWPLAN_ALL ON");
|
||||
$return = $connection->query($query);
|
||||
|
|
|
@ -769,6 +769,14 @@ if (!defined("DRIVER")) {
|
|||
return queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")");
|
||||
}
|
||||
|
||||
/** Get last auto increment ID
|
||||
* @return string
|
||||
*/
|
||||
function last_id() {
|
||||
global $connection;
|
||||
return $connection->result("SELECT LAST_INSERT_ID()"); // mysql_insert_id() truncates bigint
|
||||
}
|
||||
|
||||
/** Explain select
|
||||
* @param Min_DB
|
||||
* @param string
|
||||
|
|
|
@ -466,6 +466,10 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . $connection->qu
|
|||
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
return 0; // there can be several sequences
|
||||
}
|
||||
|
||||
function explain($connection, $query) {
|
||||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
|
|
@ -500,6 +500,11 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
global $connection;
|
||||
return $connection->result("SELECT LAST_INSERT_ROWID()");
|
||||
}
|
||||
|
||||
function explain($connection, $query) {
|
||||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
|||
}
|
||||
query_redirect("UPDATE" . limit1(table($TABLE) . " SET" . implode(",", $set) . "\nWHERE $where"), $location, lang('Item has been updated.'));
|
||||
} else {
|
||||
queries_redirect($location, lang('Item has been inserted.'), insert_into($TABLE, $set));
|
||||
$result = insert_into($TABLE, $set);
|
||||
$last_id = ($result ? last_id() : 0);
|
||||
queries_redirect($location, lang('Item%s has been inserted.', ($last_id ? " $last_id" : "")), $result); //! link
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ $translations = array(
|
|||
'Create new table' => 'Vytvořit novou tabulku',
|
||||
'Item has been deleted.' => 'Položka byla smazána.',
|
||||
'Item has been updated.' => 'Položka byla aktualizována.',
|
||||
'Item has been inserted.' => 'Položka byla vložena.',
|
||||
'Item%s has been inserted.' => 'Položka%s byla vložena.',
|
||||
'Edit' => 'Upravit',
|
||||
'Insert' => 'Vložit',
|
||||
'Save and insert next' => 'Uložit a vložit další',
|
||||
|
|
|
@ -9,8 +9,9 @@ Remember export parameters in cookie
|
|||
Allow semicolon as CSV separator
|
||||
Autofocus username in login form
|
||||
Disable spellchecking in SQL textareas
|
||||
Japanese translation
|
||||
Display auto_increment value of inserted item
|
||||
Link table names in SQL queries
|
||||
Japanese translation
|
||||
Defer table information in database overview to JavaScript (performance)
|
||||
Big tables optimizations (performance)
|
||||
|
||||
|
|
Loading…
Reference in a new issue