mirror of
https://github.com/yiisoft/yii2.git
synced 2026-02-20 00:32:19 +01:00
Fix #20628: Fix @return annotations for lastInsertId methods in yii\db\mssql namespace
This commit is contained in:
@@ -65,6 +65,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #20619: Fix `@return` annotation for `yii\db\Query::prepare()` (mspirkov)
|
||||
- Bug #20618: Fix `@var` annotation for `yii\web\Response::$acceptMimeType` (mspirkov)
|
||||
- Bug #20617: Fix `@return` annotation for `DataColumn::getDataCellValue()` (mspirkov)
|
||||
- Bug #20628: Fix `@return` annotations for `lastInsertId` methods in `yii\db\mssql` namespace (mspirkov)
|
||||
- Bug #20630: Fix `@var` annotations for `yii\web\CompositeUrlRule::$rules` and `yii\web\GroupUrlRule::$rules` (mspirkov)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class DBLibPDO extends \PDO
|
||||
/**
|
||||
* Returns value of the last inserted ID.
|
||||
* @param string|null $name the sequence name. Defaults to null.
|
||||
* @return int last inserted ID value.
|
||||
* @return string|false last inserted ID value.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function lastInsertId($name = null)
|
||||
|
||||
@@ -19,7 +19,7 @@ class PDO extends \PDO
|
||||
/**
|
||||
* Returns value of the last inserted ID.
|
||||
* @param string|null $sequence the sequence name. Defaults to null.
|
||||
* @return int last inserted ID value.
|
||||
* @return string|false last inserted ID value.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function lastInsertId($sequence = null)
|
||||
|
||||
@@ -24,7 +24,7 @@ class SqlsrvPDO extends \PDO
|
||||
* But when parameter is not specified it works as expected and returns actual
|
||||
* last inserted ID (like the other PDO drivers).
|
||||
* @param string|null $sequence the sequence name. Defaults to null.
|
||||
* @return int last inserted ID value.
|
||||
* @return string|false last inserted ID value.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function lastInsertId($sequence = null)
|
||||
|
||||
@@ -1267,7 +1267,7 @@ SQL;
|
||||
$sql = 'INSERT INTO {{profile}}([[description]]) VALUES (\'non duplicate\')';
|
||||
$command = $db->createCommand($sql);
|
||||
$command->execute();
|
||||
$this->assertEquals(3, $db->getSchema()->getLastInsertID());
|
||||
$this->assertSame('3', $db->getSchema()->getLastInsertID());
|
||||
}
|
||||
|
||||
public function testQueryCache(): void
|
||||
|
||||
@@ -39,7 +39,7 @@ class CommandTest extends \yiiunit\framework\db\CommandTest
|
||||
$sql = 'INSERT INTO {{profile}}([[description]]) VALUES (\'non duplicate\')';
|
||||
$command = $db->createCommand($sql);
|
||||
$command->execute();
|
||||
$this->assertEquals(3, $db->getSchema()->getLastInsertID('profile_SEQ'));
|
||||
$this->assertSame('3', $db->getSchema()->getLastInsertID('profile_SEQ'));
|
||||
}
|
||||
|
||||
public function batchInsertSqlProvider()
|
||||
|
||||
@@ -72,12 +72,12 @@ class CommandTest extends \yiiunit\framework\db\CommandTest
|
||||
$sql = 'INSERT INTO {{profile}}([[description]]) VALUES (\'non duplicate\')';
|
||||
$command = $db->createCommand($sql);
|
||||
$command->execute();
|
||||
$this->assertEquals(3, $db->getSchema()->getLastInsertID('public.profile_id_seq'));
|
||||
$this->assertSame('3', $db->getSchema()->getLastInsertID('public.profile_id_seq'));
|
||||
|
||||
$sql = 'INSERT INTO {{schema1.profile}}([[description]]) VALUES (\'non duplicate\')';
|
||||
$command = $db->createCommand($sql);
|
||||
$command->execute();
|
||||
$this->assertEquals(3, $db->getSchema()->getLastInsertID('schema1.profile_id_seq'));
|
||||
$this->assertSame('3', $db->getSchema()->getLastInsertID('schema1.profile_id_seq'));
|
||||
}
|
||||
|
||||
public function dataProviderGetRawSql()
|
||||
|
||||
Reference in New Issue
Block a user