X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F71mysql.t;h=1f45311b351a1a279274d8bab0b3c4fff6adc013;hb=64b39761640eb1055d8b5833566613efe941b177;hp=84bebc727422e18b1e0d656819d9ff7e72890594;hpb=5b0bea843cd41bd5f81805bc0175c23465f8247f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/71mysql.t b/t/71mysql.t index 84bebc7..1f45311 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -411,4 +411,32 @@ ZEROINSEARCH: { ok ($rs->find({ name => "Hardcore Forker $pid" }), 'Expected row created'); } +# Verify that populate in void context uses INSERT INTO foo VALUES (), (), () +# instead of 3 distinct SQL statements as other databases may require. +{ + my $rsrc = $schema->resultset('Artist')->result_source; + my ($rv, $sth, @bind) = $schema->storage->insert_bulk( + $rsrc, + [qw/ artistid name rank charfield /], + [ + [ 100, 'John', 200, 'Smith' ], + [ 101, 'Joan', 201, 'Snith' ], + ], + ); + + is_same_sql_bind( + $sth->{Statement}, + \@bind, + q{INSERT INTO artist ( artistid, name, rank, charfield ) VALUES ( ?, ?, ?, ? ), ( ?, ?, ?, ? )}, + [ + map { [ dummy => $_ ] } ( + 100, 'John', 200, 'Smith', + 101, 'Joan', 201, 'Snith', + ), + ], + ); + + is( $schema->resultset('Artist')->find( 100 )->name, 'John' ); +} + done_testing;