`finish` not called when all data fetched from a SELECT statement
Per the DBI docs for finish: "When all the data has been fetched from a SELECT statement, the driver will automatically call finish for you."
But DBD::Mock doesn’t, unless I misunderstand what should happen after I query a mock resultset for the second time.
use Test::More tests => 2;
use DBI;
my $dbh = DBI->connect('dbi:Mock:');
$dbh->{mock_add_resultset} = [ ['foo'], map { [$_] } ( 1 .. 10 ) ];
is scalar @{ $dbh->selectall_arrayref('SELECT foo FROM bar') }, 10,
'initial selectall_arrayref';
is scalar @{ $dbh->selectall_arrayref('SELECT foo FROM bar') }, 10,
'second selectall_arrayref';
results in:
1..2
ok 1 - initial selectall_arrayref
not ok 2 - second selectall_arrayref
# Failed test 'second selectall_arrayref'
# at - line 9.
# got: '0'
# expected: '10'
# Looks like you failed 1 test of 2.