Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.0
-
Fix Version/s: 1.2.2
-
Component/s: Record
-
Labels:None
-
Environment:Hidewindows XP SP3, SQL server version:(
[major] => 9
[minor] => 00
[patch] => 4035
[extra] =>
[native] => Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)
Nov 24 2008 13:01:59
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3))
Showwindows XP SP3, SQL server version:( [major] => 9 [minor] => 00 [patch] => 4035 [extra] => [native] => Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86) Nov 24 2008 13:01:59 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3))
Description
in Doctrine/Sequence/Mssql.php the function lastInsertId() fails to retrieve the last inserted ID when inserting a record. Because the major release of my sql server is bigger than 8, it chooses $query = 'select SCOPY_IDENTITY()' which does not return a number (in fact it does not return anything), although the record IS inserted succesfully. The backtrace is attached.
If, on the other hand, I force doctrine to use 'select @@IDENTITY' the query does return the correct number and everything goes fine!
So I think the conditions which query to choose is incorrect. I tried both queries in SQL server itself and both queries returned the right number. But one of them gets lost somewhere when using it in doctrine.
Activity
aiso haikens
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | ff.txt [ 10206 ] |
aiso haikens
made changes -
| Attachment | ff.txt [ 10207 ] |
Juozas Kaziukenas
made changes -
| Attachment | mssql.patch [ 10211 ] |
aiso haikens
made changes -
| Attachment | mssql2.patch [ 10226 ] |
Jonathan H. Wage
made changes -
| Status | Open [ 1 ] | Closed [ 6 ] |
| Fix Version/s | 1.2.2 [ 10047 ] | |
| Resolution | Fixed [ 1 ] |