cvs: pear /MDB2/MDB2/Driver mssql.php

From: Date: Thu, 15 Jun 2006 04:45:41 +0000
Subject: cvs: pear /MDB2/MDB2/Driver mssql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-40696@lists.php.net to get a copy of this message
nrf Thu Jun 15 04:45:41 2006 UTC Modified files: /pear/MDB2/MDB2/Driver mssql.php Log: - only use SCOPE_IDENTITY() when version >= 8 (SQL Server 2000) otherwise fallback to @@IDENTITY. http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/mssql.php?r1=1.124&r2=1.125&diff_format=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.124 pear/MDB2/MDB2/Driver/mssql.php:1.125 --- pear/MDB2/MDB2/Driver/mssql.php:1.124 Thu Jun 15 04:43:32 2006 +++ pear/MDB2/MDB2/Driver/mssql.php Thu Jun 15 04:45:41 2006 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.124 2006/06/15 04:43:32 nrf Exp $ +// $Id: mssql.php,v 1.125 2006/06/15 04:45:41 nrf Exp $ // // {{{ Class MDB2_Driver_mssql /** @@ -573,7 +573,16 @@ */ function lastInsertID($table = null, $field = null) { - return $this->queryOne("SELECT SCOPE_IDENTITY() FROM $table", 'integer'); + $server_info = $this->getServerVersion(); + if (is_array($server_info) + && $server_info['major'] == null + && $server_info['major'] >= 8) { + $query = "SELECT SCOPE_IDENTITY()"; + } else { + $query = "SELECT @@IDENTITY"; + } + + return $this->queryOne($query, 'integer'); } // }}} }

« previous php.pear.cvs (#40696) next »