mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 14:46:36 +02:00
Pass $result to last_id
This commit is contained in:
@@ -547,7 +547,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
|
||||
;
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return get_val("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT
|
||||
}
|
||||
|
||||
|
@@ -1056,9 +1056,10 @@ if (!defined('Adminer\DRIVER')) {
|
||||
}
|
||||
|
||||
/** Get last auto increment ID
|
||||
* @param Result or true
|
||||
* @return string
|
||||
*/
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return get_val("SELECT LAST_INSERT_ID()"); // mysql_insert_id() truncates bigint
|
||||
}
|
||||
|
||||
|
@@ -495,7 +495,7 @@ AND c_src.TABLE_NAME = " . q($table);
|
||||
return apply_queries("DROP TABLE", $tables);
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return 0; //!
|
||||
}
|
||||
|
||||
|
@@ -780,7 +780,7 @@ ORDER BY SPECIFIC_NAME');
|
||||
return idf_escape($name) . "(" . implode(", ", $return) . ")";
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return 0; // there can be several sequences
|
||||
}
|
||||
|
||||
|
@@ -680,7 +680,7 @@ if (isset($_GET["sqlite"])) {
|
||||
return queries("BEGIN");
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return get_val("SELECT LAST_INSERT_ROWID()");
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
||||
}
|
||||
} else {
|
||||
$result = $driver->insert($TABLE, $set);
|
||||
$last_id = ($result ? last_id() : 0);
|
||||
$last_id = ($result ? last_id($result) : 0);
|
||||
queries_redirect($location, lang('Item%s has been inserted.', ($last_id ? " $last_id" : "")), $result); //! link
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ if ($_POST && !$error) {
|
||||
}
|
||||
$message = lang('%d item(s) have been affected.', $affected);
|
||||
if ($_POST["clone"] && $result && $affected == 1) {
|
||||
$last_id = last_id();
|
||||
$last_id = last_id($result);
|
||||
if ($last_id) {
|
||||
$message = lang('Item%s has been inserted.', " $last_id");
|
||||
}
|
||||
|
@@ -383,7 +383,7 @@ if (isset($_GET["clickhouse"])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return 0; // ClickHouse doesn't have it
|
||||
}
|
||||
|
||||
|
@@ -570,7 +570,7 @@ if (isset($_GET["elastic"])) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return connection()->last_id;
|
||||
}
|
||||
}
|
||||
|
@@ -403,7 +403,7 @@ if (isset($_GET["mongo"])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
return connection()->last_id;
|
||||
}
|
||||
|
||||
|
@@ -395,7 +395,7 @@ if (isset($_GET["simpledb"])) {
|
||||
return ($where ? null : $table_status["Rows"]);
|
||||
}
|
||||
|
||||
function last_id() {
|
||||
function last_id($result) {
|
||||
}
|
||||
|
||||
function sdb_request($action, $params = array()) {
|
||||
|
Reference in New Issue
Block a user