[postmodern-devel] Patch: query callback support

Maciej Pasternacki maciej at pasternacki.net
Mon Dec 22 22:56:48 UTC 2008


*QUERY-LOG* is actually quite convenient debugging hack, it's really  
useful to have it on and see actual queries scrolling on Slime REPL,  
especially when I generate s-sql on the fly.  It may be useful to keep  
it, only maybe change default *QUERY-CALLBACK* to NIL to avoid the  
call overhead when default *QUERY-LOG* is NIL anyway.

Regards,
Maciej.

On 2008-12-22, at 12:34, Marijn Haverbeke wrote:

> Hey Maciej,
>
> Thanks for the patch. Has been applied. I think I will remove
> *query-log* in a future version, it was just a debugging hack anyway,
> and this callback system is more general and pleasant.
>
> Best,
> Marijn
>
>
> 2008/12/21 Maciej Pasternacki <maciej at pasternacki.net>:
>> Hello,
>>
>> Recently I wanted to start profiling my webapp and display some  
>> stats in
>> footer, namely number of queries and total time spent waiting for the
>> database.  Only option provided by Postmodern was using
>> CL-POSTGRES:*QUERY-LOG* and reparsing its output, but this would be  
>> just
>> awful Perl-like approach, and the time given would be very  
>> inaccurate (most
>> of my queries are short, and query log rounds time to full  
>> milliseconds, so
>> most queries show as 0ms).  I added *QUERY-CALLBACK* support for
>> cl-postgres, which makes CL-Postgres call given function with query  
>> string
>> and internal time units spent after every query, moved *QUERY-LOG*  
>> support
>> to separate function LOG-QUERY, which I made default value of
>> *QUERY-CALLBACK* for backwards compatibility.
>>
>> Darcs changeset is attached.
>>
>> Regards,
>> Maciej.
>>
>> --
>> Maciej Pasternacki -><- http://www.pasternacki.net/ -><-
>> http://www.3ofcoins.net/
>>
>> _______________________________________________
>> postmodern-devel mailing list
>> postmodern-devel at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
>>
>>
>
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel

-- 
Maciej Pasternacki -><- http://www.pasternacki.net/ -><- http://www.3ofcoins.net/





More information about the postmodern-devel mailing list