Dennis Cote wrote:
On 2/18/06, Teg <[EMAIL PROTECTED]> wrote:
I always assume the prepared statement were transitory. I typically
create them in a function, use them than delete them. Is there a
discussion of their life span somewhere? I typically have DB's that
never change schema after their initial creation. How reliable is it
to say, create the prepared statement in a constructor and use them
for the life of the class?
Teg,
Saving a prepared statement works well.
In my application, which also uses a static schema, we prepare a SQL
statement the first time it is executed, and save the prepared statemet in a
cache. The next time it is executed, the previously prepared statement is
pulled from the cache and re-executed.
HTH
Dennis Cote
I tend to prep all SQL statements on initializaton of the program with
the intent of intercepting any errors and minimizing subsequent repeated
execution overhead. Each prep'd statement persists for the duration of
the process, and that works robustly and efficiently.
JS