X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=8c4790e6c3b7619690742509d77d9c6ee34079f1;hb=00f574412a72ccd315cba27036b6e9b664e96a2b;hp=3937cb51a827624a4c00a646d178b738c74b35fe;hpb=af6aac2d51a435fa60151ac047e1559257fd4eba;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 3937cb5..8c4790e 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -153,6 +153,10 @@ the database. Its value may contain: =over +=item a scalar + +This contains one SQL statement to execute. + =item an array reference This contains SQL statements to execute in order. Each element contains @@ -626,19 +630,25 @@ sub _populate_dbh { $self->_conn_tid(threads->tid) if $INC{'threads.pm'}; my $connection_do = $self->on_connect_do; - $self->_do_connection_actions($connection_do) if ref($connection_do); + $self->_do_connection_actions($connection_do) if $connection_do; } sub _do_connection_actions { my $self = shift; my $connection_do = shift; - if (ref $connection_do eq 'ARRAY') { + if (!ref $connection_do) { + $self->_do_query($connection_do); + } + elsif (ref $connection_do eq 'ARRAY') { $self->_do_query($_) foreach @$connection_do; } elsif (ref $connection_do eq 'CODE') { $connection_do->($self); } + else { + $self->throw_exception (sprintf ("Don't know how to process conection actions of type '%s'", ref $connection_do) ); + } return $self; }