PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #3725

MDB2_Extended::buildManipSQL() is broken

Details

Submitted2005-03-06 23:29 UTC
Fromakorthaus at web dot de
Assignedlsmith
StatusClosed
PackageMDB2
PHP Version5.0.3
OSLinux 2.4.28 (Gentoo)
Roadmaps(Not assigned)

Comments

[2005-03-06 23:29 UTC] akorthaus at web dot de

Description:
------------
With version 1.21 of MDB2/Extended.php there has been introduced a bug with the following change:
"tweaked buildManipSQL() to not use loops (bug #3721)"

The following patch solves the bug:

Reproduce code:
---------------
--- Extended.php_orig 2005-03-07 00:24:36.000000000 +0100
+++ Extended.php 2005-03-07 00:25:10.000000000 +0100
@@ -165,12 +165,12 @@
}
switch ($mode) {
case MDB2_AUTOQUERY_INSERT:
- $cols = implode(', ', array_keys($table_fields));
+ $cols = implode(', ', $table_fields);
$values = '?'.str_repeat(', ?', count($table_fields)-1);
return 'INSERT INTO '.$table.' ('.$cols.') VALUES ('.$values.')';
break;
case MDB2_AUTOQUERY_UPDATE:
- $set = implode(' = ?, ', array_keys($table_fields)).' = ?';
+ $set = implode(' = ?, ', $table_fields).' = ?';
$sql = 'UPDATE '.$table.' SET '.$set;
if ($where !== false) {
$sql .= ' WHERE '.$where;

[2005-03-06 23:34 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

Doh. I did some limited tests, but it seems like I was totaly blind. Thx

[2005-03-06 23:35 UTC] akorthaus at web dot de

fixed in 5 minutes after reporting? That's not bad ;-)