Reputation: 2005
Are there any ways to convert Zend db Select or Zend DB query to SQL query before querying the database? Any other workarounds?
As I want to build a more complex SQL query that Zend DB cannot handle, without modifying my current Zend db code structure.
Upvotes: 5
Views: 4358
Reputation: 3844
For Zend Framework 1.*
you can use assemble
echo $select->assemble();
Upvotes: 1
Reputation: 20574
For a Zend\Db\Sql\Select
object (In Zend 2.2),
$select->getSqlString();
worked for me.
Upvotes: 3
Reputation: 4635
You can convert a Zend db Select object to string by $select->__toString()
Upvotes: 6
Reputation: 1771
You can always echo $select
which will return string with plain SQL query.
Upvotes: 3