开发者

CakePHP: Return the SQL for Model::find() rather than running it

开发者 https://www.devze.com 2022-12-12 11:50 出处:网络
Is there a way to get the SQL which would be run for a particular开发者_开发百科 find() query, rather than actually running it?

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.


found this article a while back

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

hope it helps

0

精彩评论

暂无评论...
验证码 换一张
取 消