[Bast-commits] r7760 -
DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sun Oct 4 20:19:56 GMT 2009
Author: caelum
Date: 2009-10-04 20:19:56 +0000 (Sun, 04 Oct 2009)
New Revision: 7760
Modified:
DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm
Log:
minor optimization for insert_bulk
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-10-04 11:17:53 UTC (rev 7759)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm 2009-10-04 20:19:56 UTC (rev 7760)
@@ -1347,15 +1347,16 @@
my %colvalues;
@colvalues{@$cols} = (0..$#$cols);
- # pass scalarref to SQLA for literal sql if it's the same in all slices
for my $i (0..$#$cols) {
my $first_val = $data->[0][$i];
next unless ref $first_val eq 'SCALAR';
- $colvalues{ $cols->[$i] } = $first_val
- if (grep {
- ref $_ eq 'SCALAR' && $$_ eq $$first_val
- } map $data->[$_][$i], (1..$#$data)) == (@$data - 1);
+ $colvalues{ $cols->[$i] } = $first_val;
+## This is probably unnecessary since $rs->populate only looks at the first
+## slice anyway.
+# if (grep {
+# ref $_ eq 'SCALAR' && $$_ eq $$first_val
+# } map $data->[$_][$i], (1..$#$data)) == (@$data - 1);
}
my ($sql, $bind) = $self->_prep_for_execute (
@@ -1378,7 +1379,7 @@
my $rv = do {
if ($empty_bind) {
# bind_param_array doesn't work if there are no binds
- $self->_execute_array_empty( $sth, scalar @$data );
+ $self->_dbh_execute_inserts_with_no_binds( $sth, scalar @$data );
}
else {
# @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
@@ -1456,7 +1457,7 @@
return $sth->execute_array({ArrayTupleStatus => $tuple_status});
}
-sub _execute_array_empty {
+sub _dbh_execute_inserts_with_no_binds {
my ($self, $sth, $count) = @_;
my $guard = $self->txn_scope_guard unless $self->{transaction_depth} != 0;
More information about the Bast-commits
mailing list