cvs: php4 /pear/DB pgsql.php

From: Date: Sun, 29 Jul 2001 05:11:52 +0000
Subject: cvs: php4 /pear/DB pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-371@lists.php.net to get a copy of this message
cox Sun Jul 29 01:11:52 2001 EDT Modified files: /php4/pear/DB pgsql.php Log: use pop/push error handlers in nextID and createSequence Index: php4/pear/DB/pgsql.php diff -u php4/pear/DB/pgsql.php:1.41 php4/pear/DB/pgsql.php:1.42 --- php4/pear/DB/pgsql.php:1.41 Sun Jul 22 12:09:53 2001 +++ php4/pear/DB/pgsql.php Sun Jul 29 01:11:52 2001 @@ -472,24 +472,22 @@ $sqn = preg_replace('/[^a-z0-9_]/i', '_', $seq_name); $repeat = 0; do { - // XXX HACK: temporarily force error mode to "return" - $tmp = $this->_default_error_mode; - $this->_default_error_mode = PEAR_ERROR_RETURN; + $this->pushErrorHandling(PEAR_ERROR_RETURN); $result = $this->query("SELECT NEXTVAL('${sqn}_seq')"); - $this->_default_error_mode = $tmp; + $this->popErrorHandling(); if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) { $repeat = 1; $result = $this->createSequence($seq_name); if (DB::isError($result)) { - return $result; + return $this->raiseError($result); } } else { $repeat = 0; } } while ($repeat); if (DB::isError($result)) { - return $result; + return $this->raiseError($result); } $arr = $result->fetchRow(DB_FETCHMODE_ORDERED); $result->free(); @@ -509,7 +507,10 @@ function createSequence($seq_name) { $sqn = preg_replace('/[^a-z0-9_]/i', '_', $seq_name); - return $this->query("CREATE SEQUENCE ${sqn}_seq"); + $this->pushErrorHandling(PEAR_ERROR_RETURN); + $result = $this->query("CREATE SEQUENCE ${sqn}_seq"); + $this->popErrorHandling(); + return $result; } // }}}

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