cvs: pear /MDB2/MDB2/Driver/Manager ibase.php oci8.php pgsql.php
| From: | Lukas Smith | Date: | Thu, 15 Dec 2005 16:54:53 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Manager ibase.php oci8.php pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-36883@lists.php.net to get a copy of this message | ||
lsmith Thu Dec 15 16:54:53 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver/Manager ibase.php oci8.php pgsql.php
Log:
- fixed listTableContraints()
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/ibase.php?r1=1.65&r2=1.66&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/ibase.php
diff -u pear/MDB2/MDB2/Driver/Manager/ibase.php:1.65 pear/MDB2/MDB2/Driver/Manager/ibase.php:1.66
--- pear/MDB2/MDB2/Driver/Manager/ibase.php:1.65 Wed Dec 14 12:08:44 2005
+++ pear/MDB2/MDB2/Driver/Manager/ibase.php Thu Dec 15 16:54:53 2005
@@ -42,7 +42,7 @@
// | Author: Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: ibase.php,v 1.65 2005/12/14 12:08:44 dufuz Exp $
+// $Id: ibase.php,v 1.66 2005/12/15 16:54:53 lsmith Exp $
require_once 'MDB2/Driver/Manager/Common.php';
@@ -751,14 +751,22 @@
RDB\$INDEX_NAME AS index_name
FROM RDB\$RELATION_CONSTRAINTS
WHERE RDB\$RELATION_NAME='$table'";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
+ $constraints = $db->queryCol($query);
+ if (PEAR::isError($constraints)) {
+ return $constraints;
+ }
+
+ $result = array();
+ foreach ($constraints as $constraint) {
+ if ($constraint = $this->_isIndexName($constraint)) {
+ $result[$constraint] = true;
+ }
}
+
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result);
+ $result = array_change_key_case($result, $db->options['field_case']);
}
- return $result;
+ return array_keys($result);
}
// }}}
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/oci8.php?r1=1.52&r2=1.53&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/oci8.php
diff -u pear/MDB2/MDB2/Driver/Manager/oci8.php:1.52 pear/MDB2/MDB2/Driver/Manager/oci8.php:1.53
--- pear/MDB2/MDB2/Driver/Manager/oci8.php:1.52 Wed Dec 14 11:57:55 2005
+++ pear/MDB2/MDB2/Driver/Manager/oci8.php Thu Dec 15 16:54:53 2005
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
-// $Id: oci8.php,v 1.52 2005/12/14 11:57:55 lsmith Exp $
+// $Id: oci8.php,v 1.53 2005/12/15 16:54:53 lsmith Exp $
require_once 'MDB2/Driver/Manager/Common.php';
@@ -685,16 +685,24 @@
}
$table = strtoupper($table);
$query = "SELECT index_name name FROM user_constraints WHERE
table_name='$table'";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
+ $constraints = $db->queryCol($query);
+ if (PEAR::isError($constraints)) {
+ return $constraints;
+ }
+
+ $result = array();
+ foreach ($constraints as $constraint) {
+ if ($constraint = $this->_isIndexName($constraint)) {
+ $result[$constraint] = true;
+ }
}
+
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
&& $db->options['field_case'] == CASE_LOWER
) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result);
+ $result = array_change_key_case($result, $db->options['field_case']);
}
- return $result;
+ return array_keys($result);
}
// }}}
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/pgsql.php?r1=1.44&r2=1.45&diff_format=u
Index: pear/MDB2/MDB2/Driver/Manager/pgsql.php
diff -u pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.44 pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.45
--- pear/MDB2/MDB2/Driver/Manager/pgsql.php:1.44 Wed Dec 14 11:57:55 2005
+++ pear/MDB2/MDB2/Driver/Manager/pgsql.php Thu Dec 15 16:54:53 2005
@@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
-// $Id: pgsql.php,v 1.44 2005/12/14 11:57:55 lsmith Exp $
+// $Id: pgsql.php,v 1.45 2005/12/15 16:54:53 lsmith Exp $
require_once 'MDB2/Driver/Manager/Common.php';
@@ -547,14 +547,24 @@
$query = "SELECT DISTINCT conname FROM pg_constraint, pg_class";
$query.= " WHERE (pg_class.relname='$table') AND
(pg_class.oid=pg_constraint.conrelid)";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
+ $constraints = $db->queryCol($query);
+ if (PEAR::isError($constraints)) {
+ return $constraints;
}
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result);
+
+ $result = array();
+ foreach ($constraints as $constraint) {
+ if ($constraint = $this->_isIndexName($constraint)) {
+ $result[$constraint] = true;
+ }
}
- return $result;
+
+ if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
+ && $db->options['field_case'] == CASE_LOWER
+ ) {
+ $result = array_change_key_case($result, $db->options['field_case']);
+ }
+ return array_keys($result);
}
// }}}