tags:

views:

79

answers:

1

Is there a way to get the SQL which would be run for a particular find() query, rather than actually running it?

For example:

echo $this->Users->find_sql('all');
// "SELECT User.id, User.username FROM users User WHERE 1=1"

My own situation would be a little more complicated than this, but I hope it illustrates the desired output.

+1  A: 

found this article a while back

http://bakery.cakephp.org/articles/view/get-the-find-query-sql-rather-than-query-result

hope it helps

Raz