sub opendb { my $self=shift; local($@); if ( not $self->{_dbh} or not $self->{_dbh}->ping) { eval{ $self->{_dbh}=$self->{_dbi}->connect() ; } ; if ( $@ ) { $self->Log('!',$@) and die "db gives error" ; } } $self->{_dbh}->{LongReadLen}=100000; # to handle Long column types $self->{_dbh}->{LongTruncOk}=0; # generates an error when the data is too long $self->{_dbh}->{AutoCommit}=0; # Lets run transactional return $self->{_dbh}; }