Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 21. máj 2025

Súbor: [Platon] / perl-modules / Platon / DBI.pm (stiahnutie)

Revízia 1.2, Sun Oct 31 11:51:37 2004 UTC (20 years, 6 months ago) by rajo


Zmeny od 1.1: +4 -4 [lines]

Export functions from Platon::DBI to Platon:DBI::db and Platon::DBI::st

#
# Platon::DBI.pm
#
# Developed by Lubomir Host 'rajo' <rajo AT platon.sk>
# 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 - <<<description of module>>>

=head1 SYNOPSIS

  use DBI;

  my $xxx = new DBI;

=head1 DESCRIPTION

The DBI module allows you ...
<<<your description here>>>

=head2 EXPORT

<<here describe exported methods>>>

=head1 SEE ALSO

=head1 AUTHORS

Lubomir Host 'rajo', <rajo AT platon.sk>

=cut

# vim: ts=4
# vim600: fdm=marker fdl=0 fdc=3


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok