ZF-223: Zend_Db_Adapter_Pdo Bind problems

Issue Type: Bug Created: 2006-07-11T01:05:04.000+0000 Last Updated: 2007-07-05T14:43:13.000+0000 Status: Resolved Fix version(s): - 0.8.0 (21/Feb/07)

Reporter: Tautvydas Andrikys (esminis) Assignee: Bill Karwin (bkarwin) Tags: - Zend_Db

  • Zend_Db_Table

Related issues: Attachments:


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

<pre class="highlight">

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); ... ```


Posted by Bill Karwin (bkarwin) on 2006-11-13T15:22:37.000+0000

Changing fix version to 0.8.0.

Posted by Bill Karwin (bkarwin) on 2007-01-05T17:07:14.000+0000

Recategorize as Zend_Db_Table component.

Posted by Bill Karwin (bkarwin) on 2007-01-08T18:33:21.000+0000

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.

Posted by Bill Karwin (bkarwin) on 2007-02-06T17:23:54.000+0000

Fixed in revision 3248.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.