> [snip]
> > > > >
> > > > > $sth = $dbh->prepare("select ... from ... where id = ?");
> > > > > $sth->execute(1); $row = $sth->fetch;
> > > > > $sth->execute(2); # dies here.
>
> Paul -- to confirm, your code which shows the problem is doing something
> like this (above)? If not, can you post a snippet? I want to confirm
> your pattern to make sure any fix solves the problem for you. Also,
> what error do you get when you don't call finish (just to make sure)?
>
> Jeff
Hi Jeff,
I'll post a precise example from work later, but basically I get an invalid cursor
state
error with code like the following:
my $sql1 = "Select X from Y";
my $sql2 = "SELECT COUNT(*) FROM Z WHERE X = ?";
my $sth1 = $dbh->prepare($sql1);
my $sth2 = $dbh->prepare($sql2);
$sth1->execute();
while (my $val = $sth1->fetchrow_array()) {
$sth2->execute($val);
$sth2->finish() # required here else "invalid cursor state" exception
}
Paul
[snip]