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
|
return get_val("SELECT SCOPE_IDENTITY()"); // @@IDENTITY can return trigger INSERT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1056,9 +1056,10 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get last auto increment ID
|
/** Get last auto increment ID
|
||||||
|
* @param Result or true
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return get_val("SELECT LAST_INSERT_ID()"); // mysql_insert_id() truncates bigint
|
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);
|
return apply_queries("DROP TABLE", $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return 0; //!
|
return 0; //!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -780,7 +780,7 @@ ORDER BY SPECIFIC_NAME');
|
|||||||
return idf_escape($name) . "(" . implode(", ", $return) . ")";
|
return idf_escape($name) . "(" . implode(", ", $return) . ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return 0; // there can be several sequences
|
return 0; // there can be several sequences
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -680,7 +680,7 @@ if (isset($_GET["sqlite"])) {
|
|||||||
return queries("BEGIN");
|
return queries("BEGIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return get_val("SELECT LAST_INSERT_ROWID()");
|
return get_val("SELECT LAST_INSERT_ROWID()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = $driver->insert($TABLE, $set);
|
$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
|
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);
|
$message = lang('%d item(s) have been affected.', $affected);
|
||||||
if ($_POST["clone"] && $result && $affected == 1) {
|
if ($_POST["clone"] && $result && $affected == 1) {
|
||||||
$last_id = last_id();
|
$last_id = last_id($result);
|
||||||
if ($last_id) {
|
if ($last_id) {
|
||||||
$message = lang('Item%s has been inserted.', " $last_id");
|
$message = lang('Item%s has been inserted.', " $last_id");
|
||||||
}
|
}
|
||||||
|
@@ -383,7 +383,7 @@ if (isset($_GET["clickhouse"])) {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return 0; // ClickHouse doesn't have it
|
return 0; // ClickHouse doesn't have it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -570,7 +570,7 @@ if (isset($_GET["elastic"])) {
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return connection()->last_id;
|
return connection()->last_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -403,7 +403,7 @@ if (isset($_GET["mongo"])) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
return connection()->last_id;
|
return connection()->last_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -395,7 +395,7 @@ if (isset($_GET["simpledb"])) {
|
|||||||
return ($where ? null : $table_status["Rows"]);
|
return ($where ? null : $table_status["Rows"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function last_id() {
|
function last_id($result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sdb_request($action, $params = array()) {
|
function sdb_request($action, $params = array()) {
|
||||||
|
Reference in New Issue
Block a user