Subject Re: [IBO] Prepare confusion
Author Frank Ingermann
Hi Scronkey,

Scronkey wrote:
> Hi there.
> I'm still a little confused about the use of prepare/unprepare.
> Are these only needed on paramterized queries?
> My scenario is that I have a query which most of the time uses one
> where clause, but occasionally I need to do a sqlWhere.Clear and use
> a different where clause.
> Do I need to unprepare/prepare in this case?
> I am finding that it works fine without using prepare at all, but
> I'm not sure if it is correct (ie speed)
> When is an unprepare explicitly needed? Always before a prepare?
> Thanks for any info.
> Rgds,
> -Ryan

as long as it's just the *params* in the Where clause you want to change, you
won't need unprepare/prepare (from the top of my head, a simple Refresh should
do - not certain though atm). To make a whole new Where clause do an
InvalidateSQL/Refresh on your query and clear/feed the SQLWhereItems in the
OnPrepareSQL event.

in general, prepare/unprepare is somewhat "expensive" so avoid it if you can.


when parsers parse, and compilers compile, then why don't objects object?

fingerbirdy - fingerman's door to Firebird