Displaying the generated SQL from a ZendDbSql object – Rob Allen's DevNotes


If you use ZendDbSql to generate your SQL, then it's useful to find out what the generated SQL looks like.

Consider code like this:

To find out what the generated SQL will look like, you can use the $select's getSqlString() method:

For me, this results in lots of warnings along the lines of:

Lots of notices

This is less than helpful, so to avoid the warnings, you need to supply the correct platform information to the method:

So we now get:

Expected SQL string

This is much better!