Subject: | Single statement preparation, multiple execute() invocations -- advice needed |
Hi,
I'm executing something which looks like the following loop:
sub some_sub {
my $dbh = DBI->connect('dbi:Mock', '', '');
$sth = $dbh->prepare('select 1 from db_patches where sha = ?');
my $found = 0;
for my $sha (@sha_values) {
$sth->execute($sha);
my $rv = $sth->fetchall_arrayref;
$sth->finish;
$found = scalar @$rv;
last if $found;
}
return $found;
}
Now, I have a test case where I want the first execute to return no rows (zero rows), but the second execute should return a single row.
From the docs on MetaCPAN, it's unclear to me how to achieve this.
Please advise!
Thanks in advance.
Erik
http://ledgersmb.org/ -- Open Source ERP in Perl