Zend Framework output ready prepared statement
How to output sql statement right before it's launched?
To check all placed data inside prepared sta开发者_JAVA技巧tement.
Zend_Db doesn't have a mechanism itself to output the sql statements that it generates. What you can do is modify the public method "query" in Zend/Db/Adapter/Abstract.php(line 445 in 1.10.6) to output the $sql local variable. The query method is called by both the update and insert methods.
There is actually a way to output the SQL it generates
$select = $db->select()->from('elements')
->where('id = ?', $this->_Id);
$sql = $select->__toString();
echo $sql;
You can also use:
echo (string) $select;
精彩评论