in reply to Re: DBI perpare_cached and statment handle gone bad
in thread DBI perpare_cached and statment handle gone bad
my $sth = $dbh->prepare_cached($statement) || try_again();That won't do what you think it does. The error is occuring on the execute, not the prepare. And prepare_cached will just return the previously prepared statement handle (which, assuming the database changed, will now be an invalid handle, but a handle nonetheless), and your try_again() will not be called.
What the OP might want to do, if caching the statement handle is worth the trouble, is cache the handle himself without using prepare_cached, and re-prepare it if it fails on the execute.
Or use prepare_cached, and if the execute fails, look at the hash ref returned by the CachedKids dbh attribute, delete the statement handle from that, and re-prepare.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: DBI perpare_cached and statment handle gone bad
by leriksen (Curate) on Jul 09, 2003 at 02:15 UTC | |
by dragonchild (Archbishop) on Jul 09, 2003 at 12:59 UTC |