diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-01-26 01:13:33 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-01-26 01:13:33 +0100 |
commit | b7a47a7b934b2771561c1cefcfc74aeada90e352 (patch) | |
tree | 6cd1cb1df7310e5d96bb071d7b15eaaf3a4dbd37 /system | |
parent | 3318ab87718775289264c5f42edfd9f912632dd8 (diff) |
A minor improvement to insert_id()
Diffstat (limited to 'system')
-rw-r--r-- | system/database/drivers/mssql/mssql_driver.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 22ed0478e..4d29920d6 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -280,13 +280,13 @@ class CI_DB_mssql_driver extends CI_DB { */ public function insert_id() { - $sql = (self::_parse_major_version($this->version()) > 7) + $query = (self::_parse_major_version($this->version()) > 7) ? 'SELECT SCOPE_IDENTITY() AS last_id' : 'SELECT @@IDENTITY AS last_id'; - $query = $this->query($sql); - $row = $query->row(); - return $row->last_id; + $query = $this->query($query); + $query = $query->row(); + return $query->last_id; } // -------------------------------------------------------------------- |