DBIx::Class::QueryLog - Log queries for later analysis.


NAME

DBIx::Class::QueryLog - Log queries for later analysis.


VERSION

Version 1.0.4


SYNOPSIS

DBIx::Class::QueryLog 'logs' each transaction and query executed so you can analyze what happened in the 'session'. It must be installed as the debugobj in DBIx::Class:

    use DBIx::Class::QueryLog;
    
    my $schema = ... # Get your schema!
    my $ql = new DBIx::Class::QueryLog();
    $schema->storage->debugobj($ql);
    $schema->storage->debug(1);
      ... # do some stuff!

Every transaction and query executed will have a corresponding Transaction and Query object stored in order of execution, like so:

    Query
    Query
    Transaction
    Query

This array can be retrieved with the log() method. Queries executed inside a transaction are stored inside their Transaction object, not inside the QueryLog directly.

See the DBIx::Class::QueryLog::Analyzer manpage for options on digesting the results of a QueryLog session.

If you wish to have the QueryLog collecting results, and the normal trace output of SQL queries from DBIx::Class, then set passthru to 1


METHODS

new

Create a new DBIx::Class::QueryLog.

time_elapsed

Returns the total time elapsed for ALL transactions and queries in this log.

count

Returns the number of queries executed in this QueryLog

reset

Reset this QueryLog by removing all transcations and queries.

add_to_log

Add this provided Transaction or Query to the log.

txn_begin

Called by DBIx::Class when a transaction is begun.

txn_commit

Called by DBIx::Class when a transaction is committed.

txn_rollback

Called by DBIx::Class when a transaction is rolled back.

query_start

Called by DBIx::Class when a query is begun.

query_end

Called by DBIx::Class when a query is completed.


AUTHOR

Cory 'G' Watson, <gphat at cpan.org>


BUGS

Please report any bugs or feature requests to bug-dbix-class-querylog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DBIx::Class::QueryLog

You can also look for information at:


ACKNOWLEDGEMENTS


COPYRIGHT & LICENSE

Copyright 2007 Cory 'G' Watson, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

 DBIx::Class::QueryLog - Log queries for later analysis.