Am Mo, 8.12.2008, 14:37, schrieb Deviloper:
> Hi there,
>
> I have a script which uses (lets say) 25 Queries in Loops. I want to
> prepare them all at the beginning of the script instead of doing something
> stupid like preparing them in the mainloop.
>
> My question is, how can I do this? Do I need 25 statementhandles? Or do I
> use prepare_cached() to cache them in this case?

You use prepare_cached().

See http://search.cpan.org/~timb/DBI-1.607/DBI.pm#prepare_cached

The caching only works if the prepared statement is the same (you can use
bound parameters if you need to change conditions etc).

You should definitely read the documentation because prepare_cached may
affect old statement handles that are still active (thats the reason why
preparing 25 statement handles before entering the loop wont work).

Hendrik

>
> Thx,
> B.
>
>


Reply via email to