cvs: pear /DB package.xml /DB/DB sybase.php
| From: | Adam Harvey | Date: | Tue, 06 Feb 2007 07:35:07 +0000 |
| Subject: | cvs: pear /DB package.xml /DB/DB sybase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44562@lists.php.net to get a copy of this message | ||
aharvey Tue Feb 6 07:35:07 2007 UTC
Modified files:
/pear/DB package.xml
/pear/DB/DB sybase.php
Log:
Updated DB_sybase::tableInfo() to cope with old versions of ASE that don't have sp_helpindex.
Bug 6683.
http://cvs.php.net/viewvc.cgi/pear/DB/package.xml?r1=1.225&r2=1.226&diff_format=u
Index: pear/DB/package.xml
diff -u pear/DB/package.xml:1.225 pear/DB/package.xml:1.226
--- pear/DB/package.xml:1.225 Tue Feb 6 07:12:11 2007
+++ pear/DB/package.xml Tue Feb 6 07:35:07 2007
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package version="1.0">
- <!-- $Id: package.xml,v 1.225 2007/02/06 07:12:11 aharvey Exp $ -->
+ <!-- $Id: package.xml,v 1.226 2007/02/06 07:35:07 aharvey Exp $ -->
<name>DB</name>
<summary>Database Abstraction Layer</summary>
<description>
@@ -75,6 +75,8 @@
sybase:
* Added divide by zero error mapping.
* Added a specific quoteFloat() implementation along the same lines as fbsql.
+* Updated tableInfo() to cope with old versions of ASE that don't have
+ sp_helpindex. Bug 6683.
]]></notes>
<filelist>
<file name="DB.php" role="php" baseinstalldir="/">
http://cvs.php.net/viewvc.cgi/pear/DB/DB/sybase.php?r1=1.84&r2=1.85&diff_format=u
Index: pear/DB/DB/sybase.php
diff -u pear/DB/DB/sybase.php:1.84 pear/DB/DB/sybase.php:1.85
--- pear/DB/DB/sybase.php:1.84 Tue Feb 6 07:12:11 2007
+++ pear/DB/DB/sybase.php Tue Feb 6 07:35:07 2007
@@ -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: sybase.php,v 1.84 2007/02/06 07:12:11 aharvey Exp $
+ * @version CVS: $Id: sybase.php,v 1.85 2007/02/06 07:35:07 aharvey Exp $
* @link http://pear.php.net/package/DB
*/
@@ -834,14 +834,24 @@
$flags = array();
$tableName = $table;
- // get unique/primary keys
- $res = $this->getAll("sp_helpindex $table", DB_FETCHMODE_ASSOC);
+ /* We're running sp_helpindex directly because it doesn't exist in
+ * older versions of ASE -- unfortunately, we can't just use
+ * DB::isError() because the user may be using callback error
+ * handling. */
+ $res = @sybase_query("sp_helpindex $table", $this->connection);
- if (!isset($res[0]['index_description'])) {
+ if ($res === false || $res === true) {
+ // Fake a valid response for BC reasons.
return '';
}
- foreach ($res as $val) {
+ while (($val = sybase_fetch_assoc($res)) !== false) {
+ if (!isset($val['index_keys'])) {
+ /* No useful information returned. Break and be done with
+ * it, which preserves the pre-1.7.9 behaviour. */
+ break;
+ }
+
$keys = explode(', ', trim($val['index_keys']));
if (sizeof($keys) > 1) {
@@ -857,6 +867,8 @@
}
}
+ sybase_free_result($res);
+
}
if (array_key_exists($column, $flags)) {