[Bast-commits] r7875 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Fri Nov 13 09:01:39 GMT 2009


Author: frew
Date: 2009-11-13 09:01:37 +0000 (Fri, 13 Nov 2009)
New Revision: 7875

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
fix subtle bug with Sybase database type determination

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-11-13 02:49:41 UTC (rev 7874)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-11-13 09:01:37 UTC (rev 7875)
@@ -63,12 +63,13 @@
     my $dbtype = eval {
       @{$self->_get_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]
     } || '';
+    $self->throw_exception("Unable to estable connection to determine database type: $@")
+      if $@;
 
-    my $exception = $@;
     $dbtype =~ s/\W/_/gi;
     my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
 
-    if (!$exception && $dbtype && $self->load_optional_class($subclass)) {
+    if ($dbtype && $self->load_optional_class($subclass)) {
       bless $self, $subclass;
       $self->_rebless;
     } else { # real Sybase
@@ -189,7 +190,7 @@
   my $self = shift;
 
   $self->next::method(@_);
-  
+
   if ($self->_is_bulk_storage) {
 # this should be cleared on every reconnect
     $self->_began_bulk_work(0);
@@ -381,7 +382,7 @@
   # we are already in a transaction, or there are no blobs
   # and we don't need the PK - just (try to) do it
   if ($self->{transaction_depth}
-        || (!$blob_cols && !$dumb_last_insert_id) 
+        || (!$blob_cols && !$dumb_last_insert_id)
   ) {
     return $self->_insert (
       $next, $source, $to_insert, $blob_cols, $identity_col
@@ -511,7 +512,7 @@
 
 # _execute_array uses a txn anyway, but it ends too early in case we need to
 # select max(col) to get the identity for inserting blobs.
-    ($self, my $guard) = $self->{transaction_depth} == 0 ? 
+    ($self, my $guard) = $self->{transaction_depth} == 0 ?
       ($self->_writer_storage, $self->_writer_storage->txn_scope_guard)
       :
       ($self, undef);




More information about the Bast-commits mailing list