1
0
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:
Jakub Vrana
2025-03-17 19:40:21 +01:00
parent 17c0960e7f
commit 19313a8dab
11 changed files with 12 additions and 11 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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; //!
}

View File

@@ -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
}

View File

@@ -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()");
}

View File

@@ -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
}
}

View File

@@ -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");
}

View File

@@ -383,7 +383,7 @@ if (isset($_GET["clickhouse"])) {
return '';
}
function last_id() {
function last_id($result) {
return 0; // ClickHouse doesn't have it
}

View File

@@ -570,7 +570,7 @@ if (isset($_GET["elastic"])) {
return $return;
}
function last_id() {
function last_id($result) {
return connection()->last_id;
}
}

View File

@@ -403,7 +403,7 @@ if (isset($_GET["mongo"])) {
return true;
}
function last_id() {
function last_id($result) {
return connection()->last_id;
}

View File

@@ -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()) {