[postmodern-devel] Patch: query callback support

Maciej Pasternacki maciej at pasternacki.net
Sun Dec 21 22:50:30 UTC 2008


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: query-callback.cset.gz
Type: application/x-gzip
Size: 9173 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20081221/2cf97e36/attachment.bin>


More information about the postmodern-devel mailing list