cvs: pear /DB package.xml /DB/DB mssql.php
| From: | Adam Harvey | Date: | Fri, 12 Jan 2007 05:16:22 +0000 |
| Subject: | cvs: pear /DB package.xml /DB/DB mssql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44200@lists.php.net to get a copy of this message | ||
aharvey Fri Jan 12 05:16:22 2007 UTC
Modified files:
/pear/DB package.xml
/pear/DB/DB mssql.php
Log:
Altered DB_mssql::nextId() to use IDENT_CURRENT instead of @@IDENTITY, thereby resolving problems
with concurrent nextId() calls. Fixes bug #181 (MSSQL: transaction logic problem with multiple
tables and concurrent inserts).
http://cvs.php.net/viewvc.cgi/pear/DB/package.xml?r1=1.219&r2=1.220&diff_format=u
Index: pear/DB/package.xml
diff -u pear/DB/package.xml:1.219 pear/DB/package.xml:1.220
--- pear/DB/package.xml:1.219 Fri Jan 12 03:11:17 2007
+++ pear/DB/package.xml Fri Jan 12 05:16:22 2007
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package version="1.0">
- <!-- $Id: package.xml,v 1.219 2007/01/12 03:11:17 aharvey Exp $ -->
+ <!-- $Id: package.xml,v 1.220 2007/01/12 05:16:22 aharvey Exp $ -->
<name>DB</name>
<summary>Database Abstraction Layer</summary>
<description>
@@ -95,6 +95,10 @@
* Altered simpleQuery() to treat EXECUTE queries as being data-returning.
Bug 5204.
+mssql:
+* Altered nextId() to use IDENT_CURRENT instead of @@IDENTITY, thereby
+ resolving problems with concurrent nextId() calls. Bug 181.
+
mysqli:
* Added the mysterious 246 data type to the type map. Bug 6477.
* Allowed the ssl option to be an integer. Bug 5657.
http://cvs.php.net/viewvc.cgi/pear/DB/DB/mssql.php?r1=1.89&r2=1.90&diff_format=u
Index: pear/DB/DB/mssql.php
diff -u pear/DB/DB/mssql.php:1.89 pear/DB/DB/mssql.php:1.90
--- pear/DB/DB/mssql.php:1.89 Fri Jan 12 03:11:17 2007
+++ pear/DB/DB/mssql.php Fri Jan 12 05:16:22 2007
@@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: mssql.php,v 1.89 2007/01/12 03:11:17 aharvey Exp $
+ * @version CVS: $Id: mssql.php,v 1.90 2007/01/12 05:16:22 aharvey Exp $
* @link http://pear.php.net/package/DB
*/
@@ -566,7 +566,15 @@
return $this->raiseError($result);
}
} elseif (!DB::isError($result)) {
- $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+ $result =& $this->query("SELECT
IDENT_CURRENT('$seqname')");
+ if (DB::isError($result)) {
+ /* Fallback code for MS SQL Server 7.0, which doesn't have
+ * IDENT_CURRENT. This is *not* safe for concurrent
+ * requests, and really, if you're using it, you're in a
+ * world of hurt. Nevertheless, it's here to ensure BC. See
+ * bug #181 for the gory details.*/
+ $result =& $this->query("SELECT @@IDENTITY FROM $seqname");
+ }
$repeat = 0;
} else {
$repeat = false;