Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #12391 lastInsertID
Submitted: 2007-11-06 19:00 UTC
From: marius Assigned: afz
Status: Closed Package: MDB2_Driver_mssql (version 1.3.0a1)
PHP Version: 5.2.4 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2007-11-06 19:00 UTC] marius (Marius Toma)
Description: ------------ function lastInsertID($table = null, $field = null) { $server_info = $this->getServerVersion(); if (is_array($server_info) && !is_null($server_info['major']) && $server_info['major'] >= 8) { $query = "SELECT SCOPE_IDENTITY()"; } else { $query = "SELECT @@IDENTITY"; } return $this->queryOne($query, 'integer'); } SCOPE_IDENTITY returns values inserted only within the current scope. A scope is a module: a stored procedure, trigger, function, or batch. Therefore, two statements are in the same scope if they are in the same stored procedure, function, or batch. (http://msdn2.microsoft.com/en-us/library/ms190315.aspx)

Comments

 [2007-11-18 17:56 UTC] quipo (Lorenzo Alberton)
So what do you suggest?
 [2008-01-31 01:10 UTC] afz (Ali Fazelzadeh)
Fixed in CVS.