mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
80e55b2ec8
9 changed files with 64 additions and 25 deletions
|
@ -690,6 +690,14 @@ abstract class driver implements driver_interface
|
|||
return $expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function sql_nextid()
|
||||
{
|
||||
return $this->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -289,12 +289,35 @@ interface driver_interface
|
|||
public function cast_expr_to_bigint($expression);
|
||||
|
||||
/**
|
||||
* Get last inserted id after insert statement
|
||||
*
|
||||
* @return int|false Autoincrement value of the last inserted row
|
||||
*/
|
||||
|
||||
* Gets the ID of the **last** inserted row immediately after an INSERT
|
||||
* statement.
|
||||
*
|
||||
* **Note**: Despite the name, the returned ID refers to the row that has
|
||||
* just been inserted, rather than the hypothetical ID of the next row if a
|
||||
* new one was to be inserted.
|
||||
*
|
||||
* The returned value can be used for selecting the item that has just been
|
||||
* inserted or for updating another table with an ID pointing to that item.
|
||||
*
|
||||
* Alias of `sql_last_inserted_id`.
|
||||
*
|
||||
* @deprecated 3.3.11-RC1 Replaced by sql_last_inserted_id(), to be removed in 4.1.0-a1
|
||||
*
|
||||
* @return int|false Auto-incremented value of the last inserted row
|
||||
*/
|
||||
public function sql_nextid();
|
||||
|
||||
/**
|
||||
* Gets the ID of the last inserted row immediately after an INSERT
|
||||
* statement. The returned value can be used for selecting the item that has
|
||||
* just been inserted or for updating another table with an ID pointing to
|
||||
* that item.
|
||||
*
|
||||
* @return int|false Auto-incremented value of the last inserted row
|
||||
*/
|
||||
public function sql_last_inserted_id();
|
||||
|
||||
/**
|
||||
* Add to query count
|
||||
*
|
||||
|
|
|
@ -316,11 +316,19 @@ class factory implements driver_interface
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_nextid()
|
||||
{
|
||||
return $this->get_driver()->sql_nextid();
|
||||
return $this->get_driver()->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->get_driver()->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -264,9 +264,9 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$result_id = @odbc_exec($this->db_connect_id, 'SELECT @@IDENTITY');
|
||||
|
||||
|
|
|
@ -269,9 +269,9 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY');
|
||||
|
||||
|
|
|
@ -285,9 +285,9 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return ($this->db_connect_id) ? (int) @mysqli_insert_id($this->db_connect_id) : false;
|
||||
}
|
||||
|
|
|
@ -568,9 +568,9 @@ class oracle extends \phpbb\db\driver\driver
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$query_id = $this->query_result;
|
||||
|
||||
|
|
|
@ -328,9 +328,9 @@ class postgres extends \phpbb\db\driver\driver
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$query_id = $this->query_result;
|
||||
|
||||
|
|
|
@ -228,9 +228,9 @@ class sqlite3 extends \phpbb\db\driver\driver
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function sql_nextid()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue