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.

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 code Commented Sep 2, 2012 at 17:24

4 Answers 4

6

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

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

3

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

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

Comments

1

For Zend Framework 1.* you can use assemble

echo $select->assemble();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.