[Bast-commits] r7747 - in DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage: . DBI

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Wed Sep 30 00:35:30 GMT 2009


Author: caelum
Date: 2009-09-30 00:35:26 +0000 (Wed, 30 Sep 2009)
New Revision: 7747

Modified:
   DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
remove _exhaaust_statements

Modified: DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-29 21:53:14 UTC (rev 7746)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-30 00:35:26 UTC (rev 7747)
@@ -277,7 +277,8 @@
     );
   }
 
-  if ($op eq 'insert' && (not $bound_identity_col) && $identity_col) {
+  if ($op eq 'insert' && (not $bound_identity_col) && $identity_col &&
+      (not $self->{insert_bulk})) {
     $sql =
       "$sql\n" .
       $self->_fetch_identity_sql($ident, $identity_col);
@@ -514,6 +515,7 @@
 
     $self     = $self->_writer_storage;
     my $guard = $self->txn_scope_guard;
+    local $self->{insert_bulk} = 1;
 
     $self->next::method(@_);
 
@@ -658,9 +660,6 @@
   }
 }
 
-# Sybase is very sensitive to this.
-sub _exhaust_statements { 1 }
-
 # Make sure blobs are not bound as placeholders, and return any non-empty ones
 # as a hash.
 sub _remove_blob_cols {

Modified: DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm	2009-09-29 21:53:14 UTC (rev 7746)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm	2009-09-30 00:35:26 UTC (rev 7747)
@@ -1461,17 +1461,7 @@
     local $dbh->{RaiseError} = 1;
     local $dbh->{PrintError} = 0;
 
-# In case of a multi-statement with a select, some DBDs (namely Sybase) require
-# the statement to be exhausted.
-    my $fetch = 0;
-    if ($self->_exhaust_statements && $sth->{Statement} =~ /(?:\n|;)select/i) {
-      $fetch = 1;
-    }
-
-    foreach (1..$count) {
-      $sth->execute;
-      $sth->fetchall_arrayref if $fetch;
-    }
+    $sth->execute foreach 1..$count;
   };
   my $exception = $@;
 
@@ -1486,11 +1476,6 @@
   return $count;
 }
 
-# Whether we prefer to exhaust cursors with results, or they can be
-# reused/finished without fetching anything. To be overridden to '1' in storages
-# that need it.
-sub _exhaust_statements { 0 }
-
 sub update {
   my ($self, $source, @args) = @_; 
 




More information about the Bast-commits mailing list