cvs: php4 /pear/DB pgsql.php
| From: | Thomas V.V.Cox | Date: | Thu, 17 Jan 2002 11:31:15 +0000 |
| Subject: | cvs: php4 /pear/DB pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1979@lists.php.net to get a copy of this message | ||
cox Thu Jan 17 06:31:15 2002 EDT
Modified files:
/php4/pear/DB pgsql.php
Log:
Test for results in _pgFieldFlags (thanks Brian Abent
<brian@onlineinfo.net>)
Index: php4/pear/DB/pgsql.php
diff -u php4/pear/DB/pgsql.php:1.62 php4/pear/DB/pgsql.php:1.63
--- php4/pear/DB/pgsql.php:1.62 Sun Jan 13 13:35:10 2002
+++ php4/pear/DB/pgsql.php Thu Jan 17 06:31:12 2002
@@ -17,7 +17,7 @@
// | Stig Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: pgsql.php,v 1.62 2002/01/13 18:35:10 cox Exp $
+// $Id: pgsql.php,v 1.63 2002/01/17 11:31:12 cox Exp $
//
// Database independent query interface definition for PHP's PostgreSQL
// extension.
@@ -597,21 +597,22 @@
AND typ.typrelid = f.attrelid
AND f.attname = '$field_name'
AND tab.relname = '$table_name'");
- $row = pg_fetch_row($result, 0);
- $flags = ($row[0] == 't') ? 'not_null ' : '';
-
- if ($row[1] == 't') {
- $result = pg_exec($this->connection, "SELECT a.adsrc
- FROM pg_attribute f, pg_class tab, pg_type typ, pg_attrdef a
- WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
- AND f.attrelid = a.adrelid AND f.attname = '$field_name'
- AND tab.relname = '$table_name'");
+ if (pg_numrows($result) > 0) {
$row = pg_fetch_row($result, 0);
- $num = str_replace('\'', '', $row[0]);
+ $flags = ($row[0] == 't') ? 'not_null ' : '';
- $flags .= "default_$num ";
- }
+ if ($row[1] == 't') {
+ $result = pg_exec($this->connection, "SELECT a.adsrc
+ FROM pg_attribute f, pg_class tab, pg_type typ, pg_attrdef a
+ WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
+ AND f.attrelid = a.adrelid AND f.attname =
'$field_name'
+ AND tab.relname = '$table_name'");
+ $row = pg_fetch_row($result, 0);
+ $num = str_replace('\'', '', $row[0]);
+ $flags .= "default_$num ";
+ }
+ }
$result = pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary,
i.indkey
FROM pg_attribute f, pg_class tab, pg_type typ, pg_index i
WHERE tab.relname = typ.typname