X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=ab28f8398499ef128faba4c3e9105b33d4925931;hb=2ab60eb9452d546818fe8a20e58e9d19c8379272;hp=20948f30c421d5b41ef45c51a82f00e282a6da7a;hpb=942cd0c142a828426a2ba3650991188c7c02178c;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 20948f3..ab28f83 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -382,15 +382,14 @@ each other. In most cases this is simply a C<.>. =item unsafe This Storage driver normally installs its own C, sets -C on, and sets C off on all database handles, -including those supplied by a coderef. It does this so that it can -have consistent and useful error behavior. +C and C on, and sets C off on +all database handles, including those supplied by a coderef. It does this +so that it can have consistent and useful error behavior. If you set this option to a true value, Storage will not do its usual -modifications to the database handle's C, C, and -C attributes, and instead relies on the settings in your -connect_info DBI options (or the values you set in your connection -coderef, in the case that you are connecting via coderef). +modifications to the database handle's attributes, and instead relies on +the settings in your connect_info DBI options (or the values you set in +your connection coderef, in the case that you are connecting via coderef). Note that your custom settings can cause Storage to malfunction, especially if you set a C handler that suppresses exceptions @@ -772,6 +771,7 @@ sub _connect { $dbh->{HandleError} = sub { $weak_self->throw_exception("DBI Exception: $_[0]") }; + $dbh->{ShowErrorStatement} = 1; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; } @@ -788,6 +788,7 @@ sub _connect { sub txn_begin { my $self = shift; + $self->ensure_connected(); if($self->{transaction_depth}++ == 0) { $self->debugobj->txn_begin() if $self->debug; @@ -1403,16 +1404,21 @@ sub deployment_statements { sub deploy { my ($self, $schema, $type, $sqltargs, $dir) = @_; foreach my $statement ( $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } ) ) { - for ( split(";\n", $statement)) { - next if($_ =~ /^--/); - next if(!$_); -# next if($_ =~ /^DROP/m); - next if($_ =~ /^BEGIN TRANSACTION/m); - next if($_ =~ /^COMMIT/m); - next if $_ =~ /^\s+$/; # skip whitespace only - $self->debugobj->query_start($_) if $self->debug; - $self->dbh->do($_); # shouldn't be using ->dbh ? - $self->debugobj->query_end($_) if $self->debug; + foreach my $line ( split(";\n", $statement)) { + next if($line =~ /^--/); + next if(!$line); +# next if($line =~ /^DROP/m); + next if($line =~ /^BEGIN TRANSACTION/m); + next if($line =~ /^COMMIT/m); + next if $line =~ /^\s+$/; # skip whitespace only + $self->debugobj->query_start($line) if $self->debug; + eval { + $self->dbh->do($line); # shouldn't be using ->dbh ? + }; + if ($@) { + warn qq{$@ (running "${line}")}; + } + $self->debugobj->query_end($line) if $self->debug; } } }