Remeber that debug_backtrace() is a very expensive function to call!
It might have a significant slowdown on your app's performance, even
if it is just in debug mode.

Anyways, you just need to implement a custom datasource and override
the logQuery() method.

[assuming you're using MySQL - if you're not then it should be easy to
adapt]

* In /app/config/database.php, set the 'driver' key to 'mysql_ex'

* Create the following file: /app/models/datasources/dbo/
dbo_mysql_ex.php

[ code here: http://bin.cakephp.org/saved/32872 ]

Then you're done!

(as a side note, I also use geshi to syntax-hilight the sql log, also
by overriding the datasource file. The two can be combined quite
nicely)

hth
grigri

On May 30, 12:31 pm, Primeminister <[EMAIL PROTECTED]> wrote:
> Hi Abhimanyu,
>
> The thing is that I want to know it on the live environment.
> The quantity of content in the database is slightly different then on
> my development environment.
>
> Anyway. Can you advise in a good debugger that has this tool?
>
> On May 29, 7:13 pm, Abhimanyu Grover <[EMAIL PROTECTED]> wrote:
>
> > I figured out best way is to use a debugger to do this debugging...
> > I'll be monitoring this thread if someone has suggestions about this.
>
> > On May 29, 8:02 pm, Primeminister <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I want to add a comment after each query that is build by cakePHP.
> > > So when I do $this->findAll($conditions) I want it to automagicly be
> > > added with a comment that will show up in my log. Example:
> > > SELECT * FROM posts AS Post WHERE id=12; /* getPost -
> > > posts_controller.php */
> > > The comment is then the function and filename where this query is
> > > called/executed.
> > > The later I can do with parsing the backtrace, but the first I don't
> > > know.
>
> > > Is there some beforeFind magic I can do? Or another thing?
>
> > > Thanks in advance!
> > > - primeminister
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to