| 1 |
use 5.008; |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Test::More; |
| 7 |
|
| 8 |
# test style cribbed from t/013_st_execute_bound_params.t |
| 9 |
|
| 10 |
BEGIN { |
| 11 |
use_ok('DBD::Mock'); |
| 12 |
use_ok('DBI'); |
| 13 |
} |
| 14 |
|
| 15 |
my $sql = 'INSERT INTO staff (first_name, last_name, dept) VALUES(?, ?, ?)'; |
| 16 |
|
| 17 |
{ |
| 18 |
my $dbh = DBI->connect( 'DBI:Mock:', '', '' ); |
| 19 |
my $sth = eval { $dbh->prepare( $sql ) }; |
| 20 |
|
| 21 |
# taken from: https://metacpan.org/module/DBI#Statement-Handle-Methods |
| 22 |
$dbh->{RaiseError} = 1; # save having to check each method call |
| 23 |
$sth = $dbh->prepare($sql); |
| 24 |
|
| 25 |
$sth->bind_param_array(1, [ 'John', 'Mary', 'Tim' ]); |
| 26 |
$sth->bind_param_array(2, [ 'Booth', 'Todd', 'Robinson' ]); |
| 27 |
# TODO: $sth->bind_param_array(3, "SALES"); # scalar will be reused for each row |
| 28 |
|
| 29 |
eval { |
| 30 |
$sth->execute_array( { ArrayTupleStatus => \my @tuple_status } ); |
| 31 |
}; |
| 32 |
ok( ! $@, 'Called execute_array() ok' ) |
| 33 |
or diag $@; |
| 34 |
} |
| 35 |
|
| 36 |
done_testing(); |