#23480 [Csd->Opn]: Sequences for DB:MySQL

From: Date: Mon, 16 Jun 2003 05:08:53 +0000
Subject: #23480 [Csd->Opn]: Sequences for DB:MySQL
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17499@lists.php.net to get a copy of this message
ID: 23480 User updated by: blair at squiz dot net Reported By: blair at squiz dot net -Status: Closed +Status: Open Bug Type: PEAR related Operating System: Redhat Linux PHP Version: 4.3.1 Assigned To: ssb New Comment: Thanks for committing the patch but you left out the changes to nextId(). Without this change the first AND second nextIds() calls that utilise the ondemand feature will return 1 Below is the diff on the lastest CVS version just to confirm. cheers, BCR Index: mysql.php =================================================================== RCS file: /repository/pear/DB/DB/mysql.php,v retrieving revision 1.17 diff -u -r1.17 mysql.php --- mysql.php 15 Jun 2003 04:45:46 -0000 1.17 +++ mysql.php 16 Jun 2003 05:03:29 -0000 @@ -523,13 +523,11 @@ $result->getCode() == DB_ERROR_NOSUCHTABLE) { $result = $this->createSequence($seq_name); - // Since createSequence initializes the ID to be 1, - // we do not need to retrieve the ID again (or we will get 2) if (DB::isError($result)) { return $this->raiseError($result); } else { - // First ID of a newly created sequence is 1 - return 1; + // now just repeat and we will get our first value + $repeat = 1; } /** BACKWARDS COMPAT **/ Previous Comments: ------------------------------------------------------------------------ [2003-06-14 23:46:31] cox@php.net This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-05-05 04:21:26] lsmith@php.net the patch is good imho as I have stated in the linked thread. It does not add overhead to common use of nextId. Also it makes the behavior finally consistent with other backends. BC issues should be minimal since the purpose of nextId is to return unique indentifiers and not a specific number. Therefore only people aware of this issues with their own BC hacks will be affected. ------------------------------------------------------------------------ [2003-05-04 18:50:17] blair at squiz dot net Just to confirm that there is no BC issue for people using nextId() with it's ondemand feature. The potential BC issue will be for those that are running createSequence() themselves (eg in an install script). ------------------------------------------------------------------------ [2003-05-04 18:27:06] nicos@php.net I'm not sure if we should apply this if we dont want to break BC. Stig ? ------------------------------------------------------------------------ [2003-05-04 18:27:05] nicos@php.net I'm not sure if we should apply this if we dont want to break BC. Stig ? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23480 -- Edit this bug report at http://bugs.php.net/?id=23480&edit=1

« previous php.pear.dev (#17499) next »