... | ... |
@@ -1,3 +1,5 @@ |
1 |
+0.2104 |
|
2 |
+ - improved bulk_insert performance |
|
1 | 3 |
0.2103 |
2 | 4 |
- added EXPERIMENTAL insert bulk_insert option. |
3 | 5 |
0.2102 |
... | ... |
@@ -502,12 +502,22 @@ sub execute { |
502 | 502 |
# Execute |
503 | 503 |
my $sth = $query->{sth}; |
504 | 504 |
my $affected; |
505 |
- if (!$query->{duplicate} && $type_rule_off && !keys %$filter && !$self->{default_out_filter} |
|
505 |
+ if ((!$query->{duplicate} || $opt{bulk_insert}) && $type_rule_off |
|
506 |
+ && !keys %$filter && !$self->{default_out_filter} |
|
506 | 507 |
&& !$opt{bind_type} && !$opt{type} && !$ENV{DBIX_CUSTOM_DEBUG}) |
507 | 508 |
{ |
508 | 509 |
eval { |
509 |
- for my $param (@$params) { |
|
510 |
- $affected = $sth->execute(map { $param->{$_} } @{$query->{columns}}); |
|
510 |
+ if ($opt{bulk_insert}) { |
|
511 |
+ my %count; |
|
512 |
+ my $param = $params->[0]; |
|
513 |
+ $affected = $sth->execute(map { $param->{$_}->[++$count{$_} - 1] } |
|
514 |
+ @{$query->{columns}}); |
|
515 |
+ } |
|
516 |
+ else { |
|
517 |
+ for my $param (@$params) { |
|
518 |
+ $affected = $sth->execute(map { $param->{$_} } |
|
519 |
+ @{$query->{columns}}); |
|
520 |
+ } |
|
511 | 521 |
} |
512 | 522 |
}; |
513 | 523 |
} |
... | ... |
@@ -2829,7 +2839,7 @@ C<insert> method use all of C<execute> method's options, |
2829 | 2839 |
and use the following new ones. |
2830 | 2840 |
|
2831 | 2841 |
=over 4 |
2832 |
- |
|
2842 |
+b |
|
2833 | 2843 |
=item C<bulk_insert> EXPERIMENTAL |
2834 | 2844 |
|
2835 | 2845 |
bulk_insert => 1 |