X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=e33b77f72cb97371952c156751c274e74b281042;hb=1a58752c42ba9acf33e2943b678de4948cf3ee3f;hp=02e2e7f630ff8f3ac54cb726fbf3aa21afc5a7c7;hpb=19f59b4fd16da149a649da5d7cfa5861ea9db35a;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 02e2e7f..e33b77f 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -836,7 +836,9 @@ sub sql_maker { return $self->_sql_maker; } +# nothing to do by default sub _rebless {} +sub _init {} sub _populate_dbh { my ($self) = @_; @@ -903,6 +905,8 @@ sub _determine_driver { $self->_driver_determined(1); + $self->_init; # run driver-specific initializations + $self->_run_connection_actions if $started_unconnected && defined $self->_dbh; } @@ -998,6 +1002,8 @@ sub _connect { $weak_self->throw_exception("DBI Exception: $_[0]"); } else { + # the handler may be invoked by something totally out of + # the scope of DBIC croak ("DBI Exception: $_[0]"); } }; @@ -1379,6 +1385,7 @@ sub insert_bulk { local $Data::Dumper::Indent = 1; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Quotekeys = 0; + local $Data::Dumper::Sortkeys = 1; $self->throw_exception(sprintf "%s for populate slice:\n%s", $tuple_status->[$i][1], @@ -2554,7 +2561,6 @@ Returns the datetime parser class sub datetime_parser { my $self = shift; return $self->{datetime_parser} ||= do { - $self->_populate_dbh unless $self->_dbh; $self->build_datetime_parser(@_); }; } @@ -2575,6 +2581,11 @@ See L =cut sub build_datetime_parser { + if (not $_[0]->_driver_determined) { + $_[0]->_determine_driver; + goto $_[0]->can('build_datetime_parser'); + } + my $self = shift; my $type = $self->datetime_parser_type(@_); $self->ensure_class_loaded ($type); @@ -2609,10 +2620,12 @@ sub lag_behind_master { sub DESTROY { my $self = shift; + $self->_verify_pid if $self->_dbh; # some databases need this to stop spewing warnings if (my $dbh = $self->_dbh) { + local $@; eval { $dbh->disconnect }; }