X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=f7e622281c0f76e30a6194e338f019728fde969b;hb=951a5760ebd3f4909a08ebdde89e5f860514094a;hp=6069398c48fa94ab2110491602e20783d55914d1;hpb=ec65fc3bf707fb8213fcdb4cad3a4d331515bc81;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 6069398..f7e6222 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1995,29 +1995,34 @@ sub insert_bulk { } for my $chunk (@chunked) { - my $current = shift @$chunk; - - my $tuple; - $tuple = sub { - my $row = do { - if (ref $current eq 'ARRAY') { - shift @$current; + if (ref $chunk eq 'REF') { + $self->_insert_bulk($source, $cols, $chunk); + } + else { + my $current = shift @$chunk; + + my $tuple; + $tuple = sub { + my $row = do { + if (ref $current eq 'ARRAY') { + shift @$current; + } + elsif (ref $current eq 'CODE') { + $current->(); + } + }; + + if ($row) { + return $row; } - elsif (ref $current eq 'CODE') { - $current->(); + elsif (!defined $row && @$chunk) { + $current = shift @$chunk; + return $tuple->(); } }; - if ($row) { - return $row; - } - elsif (!defined $row && @$chunk) { - $current = shift @$chunk; - return $tuple->(); - } - }; - - $self->_insert_bulk($source, $cols, $tuple); + $self->_insert_bulk($source, $cols, $tuple); + } } } else { @@ -2232,7 +2237,7 @@ sub _insert_bulk { # we have a split codepath here where col validation happens in the # fetch_tuple, but the tuple isnt used in no proto_bind situations, so we run it - if (not @$proto_bind) { + if (!@$proto_bind && ref $data eq 'ARRAY') { $data_filter->($data->[$_], $_) for (0..$#$data); }