From: Jess Robinson Date: Mon, 22 May 2006 08:45:35 +0000 (+0000) Subject: Call on_connect AFTER actual connection, so we have the correct sqlt_type X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=228291184a749d138481eb8987d1e60c87bc8513;p=dbsrgits%2FDBIx-Class-Historic.git Call on_connect AFTER actual connection, so we have the correct sqlt_type --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 8297e3f..e8a0ea6 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->on_connect() if($self->can('on_connect')); + $self->storage->on_connect(sub { $self->on_connect() } )if($self->can('on_connect')); return $self; } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 31b3ed8..c676254 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -243,7 +243,7 @@ __PACKAGE__->load_components(qw/AccessorGroup/); __PACKAGE__->mk_group_accessors('simple' => qw/_connect_info _dbh _sql_maker _conn_pid _conn_tid debug debugfh - cursor on_connect_do transaction_depth/); + cursor on_connect_do on_connect transaction_depth/); sub new { my $new = bless({}, ref $_[0] || $_[0]); @@ -435,6 +435,7 @@ 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'};