From: Rafael Kitover Date: Wed, 30 Sep 2009 00:35:26 +0000 (+0000) Subject: remove _exhaaust_statements X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82a1c958cf461402ca239868b751811799dd7dfe;p=dbsrgits%2FDBIx-Class-Historic.git remove _exhaaust_statements --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index f1cb9c0..04180f0 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1461,17 +1461,7 @@ sub _execute_array_empty { 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 @@ sub _execute_array_empty { 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) = @_; diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index f73f634..fc5ae30 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -277,7 +277,8 @@ sub _prep_for_execute { ); } - 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 @@ EOF $self = $self->_writer_storage; my $guard = $self->txn_scope_guard; + local $self->{insert_bulk} = 1; $self->next::method(@_); @@ -658,9 +660,6 @@ EOF } } -# 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 {