Re: Debugging SQLs

2011-02-19 Thread cricket
On Sat, Feb 19, 2011 at 8:49 PM, Ryan Schmidt
 wrote:
> On Feb 18, 2011, at 18:20, cricket wrote:
>
>> On Fri, Feb 18, 2011 at 4:05 PM, Ryan Schmidt wrote:
>>>
>>
>>> On Feb 18, 2011, at 06:10, Djonatan Buss wrote:
>>>
 I have been having the help of a friend that works with a cake but I 
 couldn't find the right way to see the SQL generated by cake.

 In order to learn it better and understand how it makes SQL and why theres 
 some troubles sometimes.

 So I would like to know how do I check every INSERT, UPDATE and SELECTs 
 that cake does.
 which method do I have to use, where it should be placed and thing like 
 that

 I'm using the cake default layout in order to check the SELECTS but I 
 would like to see the other as well...
>>>
>>> The default CakePHP SQL debugging will only show you the queries that 
>>> happened on this request. I too wanted to be able to see queries that 
>>> happened on other previous related requests -- for example, if you submit a 
>>> form that adds, edits, updates or deletes, then it will do those things, 
>>> and then redirect to another page which then displays the new data; 
>>> CakePHP's default only shows the queries to select the new data and not the 
>>> queries to actually change the data.
>>>
>>> One solution is to use the debugkit:
>>>
>>> https://github.com/cakephp/debug_kit#readme
>>>
>>> It adds a toolbar to your page where you can view the queries for each 
>>> individual page. It also has other features that may be interesting to you.
>>
>> You should check out the new Cake logging features:
>> http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3#!/view/1194/Logging
>>
>> This is exactly something I've been meaning to look into, actually.
>> I'm pretty sure, based on my own cursory examination, that this is
>> what you should be looking at. I'd like to hear back from anyone who's
>> already done something with this.
>
> So you're suggesting the queries should be logged to a file? That's certainly 
> an option, but I prefer being able to see them directly in the web page. The 
> default CakePHP query display does this, but only for queries that happened 
> on that request.

Bingo. The query display is useless where redirects are concerned.
Logging the queries elsewhere makes redirects a moot point.

> To see queries that happened on previous related requests, the debugkit can 
> be used, but I find it inconvenient to have to click a button in the bar at 
> the top and than click through each separate request to see what happened, 
> every time I want to see it.

Agreed.

> In a previous non-CakePHP project I worked on, we showed all queries since 
> the last request at the bottom of the page in a debug area. Queries were 
> simply stored in the session, and cleared out of the session when displayed. 
> This area could be shown or hidden, and this was remembered between pages too 
> (using a flag in the session). This worked well for us. I have yet to 
> investigate how to build this with CakePHP but it shouldn't be too hard to 
> do, if I spend some time looking at how debugkit was written.

That seems like a fine idea. Also one that could, I presume, be dealt
with through thecustom logging. As I said, though, I haven't yet
played with it.

But logging to a file is fine if it's only for development. Another
option would be to have the DB itself take care of it. Logging to an
in-memory table wouldn't slow things down much at all.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Debugging SQLs

2011-02-19 Thread Ryan Schmidt
On Feb 18, 2011, at 18:20, cricket wrote:

> On Fri, Feb 18, 2011 at 4:05 PM, Ryan Schmidt wrote:
>> 
> 
>> On Feb 18, 2011, at 06:10, Djonatan Buss wrote:
>> 
>>> I have been having the help of a friend that works with a cake but I 
>>> couldn't find the right way to see the SQL generated by cake.
>>> 
>>> In order to learn it better and understand how it makes SQL and why theres 
>>> some troubles sometimes.
>>> 
>>> So I would like to know how do I check every INSERT, UPDATE and SELECTs 
>>> that cake does.
>>> which method do I have to use, where it should be placed and thing like that
>>> 
>>> I'm using the cake default layout in order to check the SELECTS but I would 
>>> like to see the other as well...
>> 
>> The default CakePHP SQL debugging will only show you the queries that 
>> happened on this request. I too wanted to be able to see queries that 
>> happened on other previous related requests -- for example, if you submit a 
>> form that adds, edits, updates or deletes, then it will do those things, and 
>> then redirect to another page which then displays the new data; CakePHP's 
>> default only shows the queries to select the new data and not the queries to 
>> actually change the data.
>> 
>> One solution is to use the debugkit:
>> 
>> https://github.com/cakephp/debug_kit#readme
>> 
>> It adds a toolbar to your page where you can view the queries for each 
>> individual page. It also has other features that may be interesting to you.
> 
> You should check out the new Cake logging features:
> http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3#!/view/1194/Logging
> 
> This is exactly something I've been meaning to look into, actually.
> I'm pretty sure, based on my own cursory examination, that this is
> what you should be looking at. I'd like to hear back from anyone who's
> already done something with this.

So you're suggesting the queries should be logged to a file? That's certainly 
an option, but I prefer being able to see them directly in the web page. The 
default CakePHP query display does this, but only for queries that happened on 
that request. To see queries that happened on previous related requests, the 
debugkit can be used, but I find it inconvenient to have to click a button in 
the bar at the top and than click through each separate request to see what 
happened, every time I want to see it.

In a previous non-CakePHP project I worked on, we showed all queries since the 
last request at the bottom of the page in a debug area. Queries were simply 
stored in the session, and cleared out of the session when displayed. This area 
could be shown or hidden, and this was remembered between pages too (using a 
flag in the session). This worked well for us. I have yet to investigate how to 
build this with CakePHP but it shouldn't be too hard to do, if I spend some 
time looking at how debugkit was written.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Debugging SQLs

2011-02-18 Thread sanjib dhar
Hi!

Great plugin.I was also looking for that.Thanks cricket.

On Sat, Feb 19, 2011 at 5:50 AM, cricket  wrote:

> On Fri, Feb 18, 2011 at 4:05 PM, Ryan Schmidt
>  wrote:
> >
> > On Feb 18, 2011, at 06:10, Djonatan Buss wrote:
> >
> >> HI everyone, I'm just starting with cake and that's my first post in
> this forum.
> >
> > Welcome!
> >
> >> I have been having the help of a friend that works with a cake but I
> couldn't find the right way to see the SQL generated by cake.
> >>
> >> In order to learn it better and understand how it makes SQL and why
> theres some troubles sometimes.
> >>
> >> So I would like to know how do I check every INSERT, UPDATE and SELECTs
> that cake does.
> >> which method do I have to use, where it should be placed and thing like
> that
> >>
> >> I'm using the cake default layout in order to check the SELECTS but I
> would like to see the other as well...
> >
> > The default CakePHP SQL debugging will only show you the queries that
> happened on this request. I too wanted to be able to see queries that
> happened on other previous related requests -- for example, if you submit a
> form that adds, edits, updates or deletes, then it will do those things, and
> then redirect to another page which then displays the new data; CakePHP's
> default only shows the queries to select the new data and not the queries to
> actually change the data.
> >
> > One solution is to use the debugkit:
> >
> > https://github.com/cakephp/debug_kit#readme
> >
> > It adds a toolbar to your page where you can view the queries for each
> individual page. It also has other features that may be interesting to you.
>
> You should check out the new Cake logging features:
>
> http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3#!/view/1194/Logging
>
> This is exactly something I've been meaning to look into, actually.
> I'm pretty sure, based on my own cursory examination, that this is
> what you should be looking at. I'd like to hear back from anyone who's
> already done something with this.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
*Be Smile Always *
*SANJIB*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Debugging SQLs

2011-02-18 Thread cricket
On Fri, Feb 18, 2011 at 4:05 PM, Ryan Schmidt
 wrote:
>
> On Feb 18, 2011, at 06:10, Djonatan Buss wrote:
>
>> HI everyone, I'm just starting with cake and that's my first post in this 
>> forum.
>
> Welcome!
>
>> I have been having the help of a friend that works with a cake but I 
>> couldn't find the right way to see the SQL generated by cake.
>>
>> In order to learn it better and understand how it makes SQL and why theres 
>> some troubles sometimes.
>>
>> So I would like to know how do I check every INSERT, UPDATE and SELECTs that 
>> cake does.
>> which method do I have to use, where it should be placed and thing like that
>>
>> I'm using the cake default layout in order to check the SELECTS but I would 
>> like to see the other as well...
>
> The default CakePHP SQL debugging will only show you the queries that 
> happened on this request. I too wanted to be able to see queries that 
> happened on other previous related requests -- for example, if you submit a 
> form that adds, edits, updates or deletes, then it will do those things, and 
> then redirect to another page which then displays the new data; CakePHP's 
> default only shows the queries to select the new data and not the queries to 
> actually change the data.
>
> One solution is to use the debugkit:
>
> https://github.com/cakephp/debug_kit#readme
>
> It adds a toolbar to your page where you can view the queries for each 
> individual page. It also has other features that may be interesting to you.

You should check out the new Cake logging features:
http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3#!/view/1194/Logging

This is exactly something I've been meaning to look into, actually.
I'm pretty sure, based on my own cursory examination, that this is
what you should be looking at. I'd like to hear back from anyone who's
already done something with this.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Debugging SQLs

2011-02-18 Thread Ryan Schmidt

On Feb 18, 2011, at 06:10, Djonatan Buss wrote:

> HI everyone, I'm just starting with cake and that's my first post in this 
> forum.

Welcome!

> I have been having the help of a friend that works with a cake but I couldn't 
> find the right way to see the SQL generated by cake.
> 
> In order to learn it better and understand how it makes SQL and why theres 
> some troubles sometimes.
> 
> So I would like to know how do I check every INSERT, UPDATE and SELECTs that 
> cake does.
> which method do I have to use, where it should be placed and thing like that
> 
> I'm using the cake default layout in order to check the SELECTS but I would 
> like to see the other as well... 

The default CakePHP SQL debugging will only show you the queries that happened 
on this request. I too wanted to be able to see queries that happened on other 
previous related requests -- for example, if you submit a form that adds, 
edits, updates or deletes, then it will do those things, and then redirect to 
another page which then displays the new data; CakePHP's default only shows the 
queries to select the new data and not the queries to actually change the data.

One solution is to use the debugkit:

https://github.com/cakephp/debug_kit#readme

It adds a toolbar to your page where you can view the queries for each 
individual page. It also has other features that may be interesting to you.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Debugging SQLs

2011-02-18 Thread Djonatan Buss
HI everyone, I'm just starting with cake and that's my first post in this
forum.
I have been having the help of a friend that works with a cake but I
couldn't find the right way to see the SQL generated by cake.

In order to learn it better and understand how it makes SQL and why theres
some troubles sometimes.

So I would like to know how do I check every INSERT, UPDATE and SELECTs that
cake does.
which method do I have to use, where it should be placed and thing like that

I'm using the cake default layout in order to check the SELECTS but I would
like to see the other as well...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php