From: Brandon L. Black Date: Wed, 13 Sep 2006 21:03:01 +0000 (+0000) Subject: move !$sth exception up a level to fix storage exceptions X-Git-Tag: v0.08010~43^2~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16e10e2f31b932a758585d4155a92e584613644c;p=dbsrgits%2FDBIx-Class.git move !$sth exception up a level to fix storage exceptions --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index de6272e..f35a1e4 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -700,6 +700,7 @@ sub _connect { $dbh = DBI->connect(@info); $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{PrintWarn} = 0; } }; @@ -807,13 +808,7 @@ sub _execute { $self->debugobj->query_start($sql, @debug_bind); } - my $sth = eval { $self->sth($sql) }; - - if (!$sth || $@) { - $self->throw_exception( - 'no sth generated via sql (' . ($@ || $self->_dbh->errstr) . "): $sql" - ); - } + my $sth = $self->sth($sql); my $rv; if ($sth) { @@ -918,7 +913,10 @@ Returns a L sth (statement handle) for the supplied SQL. sub _dbh_sth { my ($self, $dbh, $sql) = @_; # 3 is the if_active parameter which avoids active sth re-use - $dbh->prepare_cached($sql, {}, 3); + $dbh->prepare_cached($sql, {}, 3) or + $self->throw_exception( + 'no sth generated via sql (' . ($@ || $dbh->errstr) . "): $sql" + ); } sub sth {