remove webgui specific dbi tracing code, simplify errorhandler

This commit is contained in:
Graham Knop 2010-04-13 19:56:25 -05:00
parent 18962e6bc9
commit 907a148313
3 changed files with 22 additions and 75 deletions

View file

@ -1,52 +0,0 @@
package WebGUI::SQL::Trace;
use strict;
#use warnings;
use 5.008008;
our $VERSION = '0.0.1';
sub PUSHED {
my ($class, $mode, $fh) = @_;
my $logger;
return bless \$logger, $class;
}
sub OPEN {
my ($self, $session, $mode, $fh) = @_;
$$self = $session;
return 1;
}
sub WRITE {
my ($self, $buf, $fh) = @_;
if ($buf =~ /\ABinding parameters: /) {
my $sql = $buf;
$sql =~ s/\ABinding parameters: //;
my $depth;
for ( $depth = 1; caller($depth); $depth++) {
my $package = caller($depth);
last
if $package !~ /\A(?:WebGUI::SQL|DBI|DBD)(?:\z|::)/;
}
local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + $depth + 1;
$$self->log->debug("Query - $sql");
}
return length($buf);
}
sub CLOSE {
my $self = shift;
return 0;
}
1;
__END__
=head1 NAME
PerlIO::via::WebGUI - Log DBI output to WebGUI
=cut