mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/8071] Make nextid alias of sql_last_inserted_id and add deprecation
PHPBB3-8071
This commit is contained in:
@@ -634,6 +634,14 @@ abstract class driver implements driver_interface
|
||||
return $expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function sql_nextid()
|
||||
{
|
||||
return $this->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@@ -299,8 +299,9 @@ interface driver_interface
|
||||
* 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.
|
||||
*
|
||||
* Will be deprecated in a future version of phpBB in favor of
|
||||
* `sql_last_inserted_id`.
|
||||
* 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 string|false Auto-incremented value of the last inserted row
|
||||
*/
|
||||
@@ -312,11 +313,7 @@ interface driver_interface
|
||||
* just been inserted or for updating another table with an ID pointing to
|
||||
* that item.
|
||||
*
|
||||
* Alias of `sql_nextid`.
|
||||
*
|
||||
* @return string|false Auto-incremented value of the last inserted row
|
||||
*
|
||||
* @since 3.3.8-RC1
|
||||
*/
|
||||
public function sql_last_inserted_id();
|
||||
|
||||
|
@@ -318,7 +318,7 @@ class factory implements driver_interface
|
||||
*/
|
||||
public function sql_nextid()
|
||||
{
|
||||
return $this->get_driver()->sql_nextid();
|
||||
return $this->get_driver()->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,7 +326,7 @@ class factory implements driver_interface
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->get_driver()->sql_nextid();
|
||||
return $this->get_driver()->sql_last_inserted_id();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -269,9 +269,9 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$result_id = @odbc_exec($this->db_connect_id, 'SELECT @@IDENTITY');
|
||||
|
||||
@@ -289,14 +289,6 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@@ -271,9 +271,9 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY');
|
||||
|
||||
@@ -290,14 +290,6 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@@ -288,20 +288,12 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
{
|
||||
return ($this->db_connect_id) ? @mysqli_insert_id($this->db_connect_id) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
return ($this->db_connect_id) ? @mysqli_insert_id($this->db_connect_id) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -570,9 +570,9 @@ class oracle extends \phpbb\db\driver\driver
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$query_id = $this->query_result;
|
||||
|
||||
@@ -607,14 +607,6 @@ class oracle extends \phpbb\db\driver\driver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@@ -342,9 +342,9 @@ class postgres extends \phpbb\db\driver\driver
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
$query_id = $this->query_result;
|
||||
|
||||
@@ -370,14 +370,6 @@ class postgres extends \phpbb\db\driver\driver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@@ -241,20 +241,12 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
return is_object($query_id) ? @$query_id->fetchArray(SQLITE3_ASSOC) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_nextid()
|
||||
{
|
||||
return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sql_last_inserted_id()
|
||||
{
|
||||
return $this->sql_nextid();
|
||||
return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user