NAME

Jifty::Plugin::SQLQueries - SQL query logging and reporting for your Jifty app

DESCRIPTION

SQL query logging and reporting for your Jifty app. Use this plugin if you wish to profile or analyze the database queries Jifty is running for individual page loads.

USAGE

Add the following to your site_config.yml

framework:
  Plugins:
    - SQLQueries: {}

This makes the following URLs available:

View the top-level query report (how many queries each request had)

http://your.app/__jifty/admin/queries

View the top-level query report, including zero-query requests

http://your.app/__jifty/admin/queries/all

View an individual request's detailed query report (which queries were made, where, how long they took, etc)

http://your.app/__jifty/admin/queries/3

METHODS

init

This makes sure that each request is wrapped with query logging.

post_init

This sets up Jifty::DBI's query logging, and is called at the end of Jifty->new

before_request

Clears the SQL log so you only get the request's queries

after_request

Logs the queries made (at level DEBUG)

halo_pre_template

Log any queries made to the previous template. Also, keep track of whatever queries made so the rest of the plugin can see them (since we clear the log)

halo_post_template

Log any queries made to the current template. Also, keep track of whatever queries made so the rest of the plugin can see them (since we clear the log)

XXX: can this somehow be refactored into one function? If the same pattern occurs elsewhere I'll look into it.

COPYRIGHT AND LICENSE

Copyright 2007 Best Practical Solutions

This is free software and may be modified and distributed under the same terms as Perl itself.