From: Jess Robinson Date: Mon, 22 May 2006 14:52:53 +0000 (+0000) Subject: Back to on_connect in connection, rather than populate_dbh, deploy ensures its connected X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb1482eb967c3f3b4faf003bdf486906cbc40552;p=dbsrgits%2FDBIx-Class-Historic.git Back to on_connect in connection, rather than populate_dbh, deploy ensures its connected --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index e8a0ea6..b085504 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -460,7 +460,7 @@ sub connection { my $storage = $storage_class->new; $storage->connect_info(\@info); $self->storage($storage); - $self->storage->on_connect(sub { $self->on_connect() } )if($self->can('on_connect')); + $self->on_connect() if($self->can('on_connect')); return $self; } @@ -715,6 +715,7 @@ across all databases, or fully handle complex relationships. sub deploy { my ($self, $sqltargs) = @_; $self->throw_exception("Can't deploy without storage") unless $self->storage; + $self->storage->ensure_connected(); $self->storage->deploy($self, undef, $sqltargs); } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index c676254..e46a7bd 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -435,7 +435,6 @@ sub _populate_dbh { foreach my $sql_statement (@{$self->on_connect_do || []}) { $self->_dbh->do($sql_statement); } - $self->on_connect->(); $self->_conn_pid($$); $self->_conn_tid(threads->tid) if $INC{'threads.pm'};