Subject Re: [IBO] Prepare + unprepare + close with IB_Query or IB_Cursor?
Author Helen Borrie (TeamIBO)
At 01:14 AM 01-08-02 +0000, you wrote:

>The Borland help file says things like:
>Note: If you attempt to execute a stored procedure before
>preparing it, the stored procedure component automatically prepares
>it for you, and then unprepares it after it executes.
>
>Does the same apply to a TIB_DSQL? ie can I be lazy when re-using
>one? If I'm changing the SQL each time before use, and only using it
>for a single fetch each time, will it automatically Prepare &
>Unprepare itself?

Clearing and replacing the SQL (as contrasted with merely assigning new
parameter values) will cause the statement object to completely clear
itself and start from scratch. Even changing the SQLWhereItems will
invalidate the SQL property and trigger an Unprepare/Prepare sequence. I
think what Jason is telling you is that, if a statement is prepared, used
and then nothing further happens to clear it, it will stay prepared and
continue to occupy the resources allocated by the Prepare.

Closing a dataset (IB_Query or IB_Cursor) won't unprepare it.

As a matter of curiosity, how are you using TIB_DSQL to fetch anything?

Notice though that TIB_DSQL is not some sort of variation to a
TIB_StoredProc...they aren't similar at all. TIB_DSQL encapsulates a bare
dynamic DML or DDL statement that doesn't return a dataset. Hence, you can
use it to EXECUTE a stored procedure but not to SELECT from one that's
designed to return a dataset.


regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com