Capitaine
Capitaine

Reputation: 2005

convert Zend Db Select query to sql query

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

Answers (4)

Sajjad Ashraf
Sajjad Ashraf

Reputation: 3844

For Zend Framework 1.* you can use assemble

echo $select->assemble();

Upvotes: 1

edi9999
edi9999

Reputation: 20574

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

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

Upvotes: 3

Nandakumar V
Nandakumar V

Reputation: 4635

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

Upvotes: 6

kasztelan
kasztelan

Reputation: 1771

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

Upvotes: 3

Related Questions