cvs: pear /DB/DB pgsql.php
| From: | Daniel Convissor | Date: | Fri, 10 Jun 2005 14:31:46 +0000 |
| Subject: | cvs: pear /DB/DB pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32461@lists.php.net to get a copy of this message | ||
danielc Fri Jun 10 10:31:46 2005 EDT
Modified files:
/pear/DB/DB pgsql.php
Log:
* Allow FETCH queries to return results. Bug 4112.
* Adjust comments to clarify the affected rows/result/nothing situation.
http://cvs.php.net/diff.php/pear/DB/DB/pgsql.php?r1=1.128&r2=1.129&ty=u
Index: pear/DB/DB/pgsql.php
diff -u pear/DB/DB/pgsql.php:1.128 pear/DB/DB/pgsql.php:1.129
--- pear/DB/DB/pgsql.php:1.128 Fri May 27 11:48:18 2005
+++ pear/DB/DB/pgsql.php Fri Jun 10 10:31:45 2005
@@ -21,7 +21,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: pgsql.php,v 1.128 2005/05/27 15:48:18 danielc Exp $
+ * @version CVS: $Id: pgsql.php,v 1.129 2005/06/10 14:31:45 danielc Exp $
* @link http://pear.php.net/package/DB
*/
@@ -336,19 +336,26 @@
if (!$result) {
return $this->pgsqlRaiseError();
}
- // Determine which queries that should return data, and which
- // should return an error code only.
+
+ /*
+ * Determine whether queries produce affected rows, result or nothing.
+ *
+ * This logic was introduced in version 1.1 of the file by ssb,
+ * though the regex has been modified slightly since then.
+ *
+ * PostgreSQL commands:
+ * ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
+ * CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
+ * GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
+ * REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
+ * UNLISTEN, UPDATE, VACUUM
+ */
if ($ismanip) {
$this->affected = @pg_affected_rows($result);
return DB_OK;
- } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|SHOW)\s/si', $query)) {
- /* PostgreSQL commands:
- ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
- CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
- GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
- REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
- UNLISTEN, UPDATE, VACUUM
- */
+ } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|FETCH|SHOW)\s/si',
+ $query))
+ {
$this->row[(int)$result] = 0; // reset the row counter.
$numrows = $this->numRows($result);
if (is_object($numrows)) {