ZF-223: Zend_Db_Adapter_Pdo Bind problems

Description

On MySQL binding in queries doesn't work right - when using Zend_Db_Table_Row->save() PDO exception occurs.



By digging into code i found out that bind array keys are not prefixed with ':', but this is required for PDO.

I'm not sure if this fix will work well for all DB adapters.

... // is the $sql a Zend_Db_Select object? if ($sql instanceof Zend_Db_Select) { $sql = $sql->__toString(); } // Fix here if(!empty($bind)){ foreach($bind as $k=>$v){ $bind[":$k"] = $v; unset($bind[$k]); } }

// prepare and execute the statement with profiling $stmt = $this->prepare($sql); $q = $this->_profiler->queryStart($sql); $stmt->execute((array) $bind); $this->_profiler->queryEnd($q); ... ```

Comments

Changing fix version to 0.8.0.

Recategorize as Zend_Db_Table component.

This probably applies to all PDO adapters, but not to native adapters that do not use PDO.

So I expect the fix to be in the class Zend_Db_Adapter_Pdo_Abstract.

Fixed in revision 3248.