cvsuser     04/12/09 13:54:13

  Modified:    App-Repository/lib/App/Repository MySQL.pm
  Log:
  add mysql_auto_reconnect to MySQL connections
  
  Revision  Changes    Path
  1.10      +17 -2     p5ee/App-Repository/lib/App/Repository/MySQL.pm
  
  Index: MySQL.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/Repository/MySQL.pm,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MySQL.pm  19 Nov 2004 04:36:11 -0000      1.9
  +++ MySQL.pm  9 Dec 2004 21:54:12 -0000       1.10
  @@ -1,12 +1,12 @@
   
   ######################################################################
  -## File: $Id: MySQL.pm,v 1.9 2004/11/19 04:36:11 spadkins Exp $
  +## File: $Id: MySQL.pm,v 1.10 2004/12/09 21:54:12 spadkins Exp $
   ######################################################################
   
   use App::Repository::DBI;
   
   package App::Repository::MySQL;
  -$VERSION = do { my @r=(q$Revision: 1.9 $=~/\d+/g); sprintf 
"%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.10 $=~/\d+/g); sprintf 
"%d."."%02d"x$#r,@r};
   
   @ISA = ( "App::Repository::DBI" );
   
  @@ -32,6 +32,21 @@
   
   =cut
   
  +sub _connect {
  +    &App::sub_entry if ($App::trace);
  +    my $self = shift;
  +
  +    if (!defined $self->{dbh}) {
  +        my $dsn = $self->_dsn();
  +        my $attr = $self->_attr();
  +        $self->{dbh} = DBI->connect($dsn, $self->{dbuser}, $self->{dbpass}, 
$attr);
  +        $self->{dbh}{mysql_auto_reconnect} = 1;
  +    }
  +
  +    &App::sub_exit(defined $self->{dbh}) if ($App::trace);
  +    return(defined $self->{dbh});
  +}
  +
   sub _dsn {
       &App::sub_entry if ($App::trace);
       my ($self) = @_;
  
  
  

Reply via email to