
DBIx::Class::Storage::Statistics::SimpleTable - DBIC statistics in a table

use My::DBIC::Schema; use DBIx::Class::Storage::Statistics::SimpleTable; my $dbic_schema = My::DBIC::Schema->connect; # using DBIx::Class::Storage::Statistics::SimpleTable as single debug object my $profiler = DBIx::Class::Storage::Statistics::SimpleTable->new(); $dbic_schema->storage->debugobj( $profiler ); $dbic_schema->debug( 1 ); # ... do stuff with your schema ... print $profiler->report->draw; # using DBIx::Class::Storage::Statistics::SimpleTable with delegation # to the original object and FirePHP::Dispatcher support my $profiler = DBIx::Class::Storage::Statistics::SimpleTable ->new( 'FirePHP::SimpleTable' ); $profiler->install( $dbic_schema ); # ... do stuff with your schema ... $firephp_dispatcher->table( 'DBIC Profile' => $profiler->report );

DBIx::Class::Storage::Statistics::SimpleTable is a DBIx::Class::Storage::Statistics subclass that gathers DBIx::Class profiling information in a Text::SimpleTable class or sub-class.
This module was created to support Catalyst::Plugin::FirePHP but maybe some will find it useful one its own.

Creates a new statistics object, optionally using the Text::SimpleTable sub-class given as argument
Installs this statistics instance into a DBIx::Class::Storage object. The original debugobj and debug state will be preserved and all statistic events delegated to the original object.
Removes this statistics instance from the associated DBIx::Class::Storage object and restores its original state.

Returns the gathered statistics as Text::SimpleTable object (or as the sub-class choosen at object creation)
Returns the total time spend in DBIx::Class queries.
Returns the number of queries processed.

Logs the starting time of the request
Write the query string, parameters and elepsed time to the statistics table.

perl, Text::SimpleTable, FirePHP::Dispatcher

Sebastian Willert, willert@cpan.org

Copyright 2009 by Sebastian Willert <willert@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.