cvs: pear /MDB/MDB fbsql.php mysql.php

From: Date: Sun, 02 Feb 2003 13:44:20 +0000
Subject: cvs: pear /MDB/MDB fbsql.php mysql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8677@lists.php.net to get a copy of this message
lsmith Sun Feb 2 08:44:20 2003 EDT Modified files: /pear/MDB/MDB mysql.php fbsql.php Log: minor error handling improvements to nextId() Index: pear/MDB/MDB/mysql.php diff -u pear/MDB/MDB/mysql.php:1.66 pear/MDB/MDB/mysql.php:1.67 --- pear/MDB/MDB/mysql.php:1.66 Tue Jan 28 08:30:40 2003 +++ pear/MDB/MDB/mysql.php Sun Feb 2 08:44:19 2003 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.66 2003/01/28 13:30:40 lsmith Exp $ +// $Id: mysql.php,v 1.67 2003/02/02 13:44:19 lsmith Exp $ // require_once('MDB/Common.php'); @@ -1284,14 +1284,16 @@ function nextId($seq_name, $ondemand = TRUE) { $sequence_name = $this->getSequenceName($seq_name); + $this->expectError(MDB_ERROR_NOSUCHTABLE); $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $this->popExpect(); if ($ondemand && MDB::isError($result) && $result->getCode() == MDB_ERROR_NOSUCHTABLE) { - $result = $this->createSequence($seq_name, 2); // Since we are create the sequence on demand // we know the first id = 1 so initialize the // sequence at 2 + $result = $this->createSequence($seq_name, 2); if (MDB::isError($result)) { return($this->raiseError(MDB_ERROR, '', '', 'Next ID: on demand sequence could not be created')); Index: pear/MDB/MDB/fbsql.php diff -u pear/MDB/MDB/fbsql.php:1.5 pear/MDB/MDB/fbsql.php:1.6 --- pear/MDB/MDB/fbsql.php:1.5 Sun Jan 19 06:12:43 2003 +++ pear/MDB/MDB/fbsql.php Sun Feb 2 08:44:19 2003 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.5 2003/01/19 11:12:43 lsmith Exp $ +// $Id: fbsql.php,v 1.6 2003/02/02 13:44:19 lsmith Exp $ // require_once('MDB/Common.php'); @@ -1258,14 +1258,16 @@ function nextId($seq_name, $ondemand = TRUE) { $sequence_name = $this->getSequenceName($seq_name); + $this->expectError(MDB_ERROR_NOSUCHTABLE); $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $this->popExpect(); if ($ondemand && MDB::isError($result) && $result->getCode() == MDB_ERROR_NOSUCHTABLE) { - $result = $this->createSequence($seq_name, 2); // Since we are create the sequence on demand // we know the first id = 1 so initialize the // sequence at 2 + $result = $this->createSequence($seq_name, 2); if (MDB::isError($result)) { return($this->raiseError(MDB_ERROR, '', '', 'Next ID: on demand sequence could not be created'));

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