ZF-8048: cannot use bind variables with Zend_Db_Adapter_Abstract::query
Description
I've a query like
$q = "INSERT INTO my_t (c1, c2, c3, field_val, mtime) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE field_val = ?, mtime = ?"
$db->query($query, array($a, $b, $c, $d, $e, $d, $e);
This call apparently fails to bind all variables; the query does nothing.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-10-11T07:20:20.000+0000
Assigning to Ralph.
Posted by Jack Tanner (jacktanner) on 2009-10-11T10:05:01.000+0000
Here's a patch implementing a Zend_Db_Adapter method for insertUpdating() . Zend_Db_Adapter_Abstract gets a default implementation that throws an exception, because I assume that most RDBMSs do not have INSERT ... ON DUPLICATE KEY or similar functionality. Zend_Db_Adapter_Pdo_Mysql gets an actual implementation, overriding the Zend_Db_Adapter_Abstract one.
The point of attaching this patch here is that it demonstrates how I'd like to call Zend_Db_Adapter_Abstract::query with bound parameters. Perhaps this patch can also serve as a starting point for implementing insertUpdating() for the framework.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-10-11T10:09:07.000+0000
Set component to Zend_Db
Posted by Rob Allen (rob) on 2012-11-20T20:53:10.000+0000
Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".
Feel free to re-open and provide a patch if you want to fix this issue.