convert Zend Db Select query to sql query
Asked Answered
B

4

5

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.

Bugleweed answered 31/8, 2012 at 23:48 Comment(1)
You are going to handcode an SQL query ? I am not sure how you can do that without changing or removing the Zend_Db_Select specific codeFolacin
S
6

You can convert a Zend db Select object to string by $select->__toString()

Selina answered 11/9, 2012 at 14:48 Comment(0)
N
3

You can always echo $select which will return string with plain SQL query.

Nowt answered 1/9, 2012 at 1:44 Comment(0)
V
3

For a Zend\Db\Sql\Select object (In Zend 2.2),

$select->getSqlString(); worked for me.

Vale answered 21/10, 2014 at 8:12 Comment(0)
A
1

For Zend Framework 1.* you can use assemble

echo $select->assemble();
Arita answered 12/6, 2021 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.