Why use prepare_cached?
in reply to Re: A more elegant solution?
in thread A more elegant solution?
It is mainly of use when you have a few statements, that you execute often, but where you are unable to hold a reference to the $sth.
And it is only usefull if the driver supports it. (Not all drivers do presently).
You should also note that for some databases prepared statements and placeholders take more time than just $dbh->do'ing the statement with values in place.
With those databases the only advantage of placeholders is that you don't have to do quoting - which is a big advantage in this situation, as we don't beforehand know the type of the columns, whether numeric or string. And yes that does make a big difference - some databases refuse to accept numbers in quotes as numbers!