cvs: pear /DB package.xml /DB/DB sqlite.php /DB/tests fetchmodes.inc /DB/tests/driver 02fetch.phpt
| From: | Adam Harvey | Date: | Fri, 21 Sep 2007 14:23:28 +0000 |
| Subject: | cvs: pear /DB package.xml /DB/DB sqlite.php /DB/tests fetchmodes.inc /DB/tests/driver 02fetch.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-48645@lists.php.net to get a copy of this message | ||
aharvey Fri Sep 21 14:23:28 2007 UTC
Modified files:
/pear/DB package.xml
/pear/DB/DB sqlite.php
/pear/DB/tests fetchmodes.inc
/pear/DB/tests/driver 02fetch.phpt
Log:
Fix for bug #11716 (SQLite returns result field names with quotes).
http://cvs.php.net/viewvc.cgi/pear/DB/package.xml?r1=1.235&r2=1.236&diff_format=u
Index: pear/DB/package.xml
diff -u pear/DB/package.xml:1.235 pear/DB/package.xml:1.236
--- pear/DB/package.xml:1.235 Fri Sep 21 13:40:41 2007
+++ pear/DB/package.xml Fri Sep 21 14:23:28 2007
@@ -86,6 +86,9 @@
mysqli:
* Added an explicit call to select the database to fix calls to tableInfo() without a preceding
query. Bug 11580.
+
+sqlite:
+* Altered fetchInto() to remove extraneous quotes returned by SQLite. Bug 11716.
</notes>
<contents>
<dir name="/">
http://cvs.php.net/viewvc.cgi/pear/DB/DB/sqlite.php?r1=1.116&r2=1.117&diff_format=u
Index: pear/DB/DB/sqlite.php
diff -u pear/DB/DB/sqlite.php:1.116 pear/DB/DB/sqlite.php:1.117
--- pear/DB/DB/sqlite.php:1.116 Fri Sep 21 13:40:42 2007
+++ pear/DB/DB/sqlite.php Fri Sep 21 14:23:28 2007
@@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0 3.0
- * @version CVS: $Id: sqlite.php,v 1.116 2007/09/21 13:40:42 aharvey Exp $
+ * @version CVS: $Id: sqlite.php,v 1.117 2007/09/21 14:23:28 aharvey Exp $
* @link http://pear.php.net/package/DB
*/
@@ -359,6 +359,16 @@
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE
&& $arr) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
+
+ /* Remove extraneous " characters from the fields in the result.
+ * Fixes bug #11716. */
+ if (is_array($arr) && count($arr) > 0) {
+ $strippedArr = array();
+ foreach ($arr as $field => $value) {
+ $strippedArr[trim($field, '"')] = $value;
+ }
+ $arr = $strippedArr;
+ }
} else {
$arr = @sqlite_fetch_array($result, SQLITE_NUM);
}
http://cvs.php.net/viewvc.cgi/pear/DB/tests/fetchmodes.inc?r1=1.12&r2=1.13&diff_format=u
Index: pear/DB/tests/fetchmodes.inc
diff -u pear/DB/tests/fetchmodes.inc:1.12 pear/DB/tests/fetchmodes.inc:1.13
--- pear/DB/tests/fetchmodes.inc:1.12 Fri Jul 6 05:19:21 2007
+++ pear/DB/tests/fetchmodes.inc Fri Sep 21 14:23:28 2007
@@ -18,7 +18,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version $Id: fetchmodes.inc,v 1.12 2007/07/06 05:19:21 aharvey Exp $
+ * @version $Id: fetchmodes.inc,v 1.13 2007/09/21 14:23:28 aharvey Exp $
* @link http://pear.php.net/package/DB
*/
@@ -162,6 +162,19 @@
$row = array();
$sth->fetchInto($row, DB_FETCHMODE_ORDERED);
print implode(" ", array_keys($row))."\n";
+$sth->free(); // keep fbsql happy.
+
+print "testing fetchmodes: fetchrow assoc quoted identifiers\n";
+$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
+$sql = sprintf('SELECT %s, %s, %s, %s FROM %s',
+ $dbh->quoteIdentifier('a'),
+ $dbh->quoteIdentifier('b'),
+ $dbh->quoteIdentifier('cc'),
+ $dbh->quoteIdentifier('d'),
+ $dbh->quoteIdentifier('phptest'));
+$sth = $dbh->query($sql);
+$row = $sth->fetchRow();
+print implode(" ", array_keys($row))."\n";
$sth->free(); // keep fbsql happy.
// keep ibase happy: can't drop tbl that has results open against it.
http://cvs.php.net/viewvc.cgi/pear/DB/tests/driver/02fetch.phpt?r1=1.9&r2=1.10&diff_format=u
Index: pear/DB/tests/driver/02fetch.phpt
diff -u pear/DB/tests/driver/02fetch.phpt:1.9 pear/DB/tests/driver/02fetch.phpt:1.10
--- pear/DB/tests/driver/02fetch.phpt:1.9 Mon Jan 8 00:19:48 2007
+++ pear/DB/tests/driver/02fetch.phpt Fri Sep 21 14:23:28 2007
@@ -38,3 +38,5 @@
a b cc d
testing fetchmodes: fetchinto assoc default with ordered specified
0 1 2 3
+testing fetchmodes: fetchrow assoc quoted identifiers
+a b cc d