Subject Re: [IBO] TIBQuery.Prepared
Author Helen Borrie
At 03:12 PM 6/07/2005 +1200, you wrote:
>Hi
>
>Is there any overhead in setting prepared := True when it is already
>true or should I check and only set it if it is?
>
>I am assuming the internal code is something like...
>
>.....
>if (fPreparded = False) then begin
> Prepare;
> fPrepared := true;
>end;
>
>.....

You shouldn't concern yourself with internal properties, even if you know
what they are. The statement object exposes the Prepared property. It is
set by calling the public method Prepare.

The class is smart enough to know not to prepare a statement that is
already prepared. The one "window" where there might be a gap under a
specific constellation of conditions is where the statement might have
become unprepared and your code tries to set a property that depends on the
statement having been prepared. Thus, it's a reasonable precaution to
include "if not Prepared then Prepare" before assigning parameter values or
assigning stateful data between datasets.

Helen



>--
>Rob Martin
>Software Engineer
>
>phone +64 03 377 0495
>fax +64 03 377 0496
>web www.chreos.com
>
>Wild Software Ltd
>
>
>
>___________________________________________________________________________
>IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
>___________________________________________________________________________
>http://www.ibobjects.com - your IBO community resource for Tech Info papers,
>keyword-searchable FAQ, community code contributions and more !
>Yahoo! Groups Links
>
>
>
>