# # Platon::DBI.pm # # Developed by Lubomir Host 'rajo' # Copyright (c) 2004 Platon SDG, http://platon.sk/ # Licensed under terms of GNU General Public License. # All rights reserved. # # Changelog: # 2004-10-19 - created # # $Platon: perl-modules/Platon/DBI.pm,v 1.1 2004/10/21 17:36:01 rajo Exp $ package Platon::DBI; use strict; use vars qw($VERSION $DEBUG); use Carp; use DBI qw(:sql_types); use base qw( DBI DBI::db DBI::st ); $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/); $DEBUG = 0 unless defined $DEBUG; sub check { # {{{ my ($self) = @_; my $rv = $self->ping(); # auto reconnect must be done explicitely, because this flag is reseted after first reconnect $self->{mysql_auto_reconnect} = 1; # we are reconnected again (probably ;-), check connection again $rv += $self->ping(); $self->{mysql_auto_reconnect} = 1; # print STDERR "------------ DBI check ------------\n"; # foreach my $key ( # 'Warn', 'Active', 'Executed', 'Kids', 'ActiveKids', 'CachedKids', # 'CompatMode', 'InactiveDestroy', 'PrintWarn', 'PrintError', 'RaiseError', 'HandleError', # 'HandleSetErr', 'ErrCount', 'ShowErrorStatement', 'TraceLevel', 'FetchHashKeyName', # 'ChopBlanks', 'LongReadLen', 'LongTruncOk', 'TaintIn', 'TaintOut', 'Taint', # 'Profile' # # ) { # print STDERR "$key\t'$self->{$key}'\n"; # } # print STDERR "-----------------------------------\n"; return $rv; } # }}} package Platon::DBI::db; use DBI qw(:sql_types); use base qw( Platon::DBI DBI::db ); sub prepare($$$;) { # {{{ my ($self, $keyword, $sql_query, $caller_pkg, $caller_file, $caller_line) = @_; return $self->SUPER::prepare("/* $keyword $caller_file:$caller_line */ $sql_query"); } # }}} package Platon::DBI::st; use DBI qw(:sql_types); use base qw( Platon::DBI DBI::st ); 1; __END__ =head1 NAME DBI - <<>> =head1 SYNOPSIS use DBI; my $xxx = new DBI; =head1 DESCRIPTION The DBI module allows you ... <<>> =head2 EXPORT <>> =head1 SEE ALSO =head1 AUTHORS Lubomir Host 'rajo', =cut # vim: ts=4 # vim600: fdm=marker fdl=0 fdc=3