Subject | Re: [IBO] IBO/IB_Query PrepareSQL question - does it fire on form creation? can I avoid that? |
---|---|
Author | Helen Borrie |
Post date | 2005-10-04T00:26:56Z |
At 12:08 AM 4/10/2005 +0200, you wrote:
client/server practice anyway, and is a relic of the BDE and Paradox.
call (or setting a dataset to Active, which is another nasty relic from
Paradox) requires the statement to be prepared. So, if you tell your app
to open a dataset, it will automatically test for Prepared and, if it's not
prepared, it will call Prepare.
For OnPrepareSQL to work, the dataset must be in the unprepared
state. Modifying SQLWhereItems and/or SQLOrder of course changes the
specification of the dataset so the Unprepare should occur automatically
when you call SQLWhereItems.Clear or SQLOrder.Clear. For DML statements,
it's wise to be a little more particular, and test for Prepared yourself.
if MyStatement.Prepared then MyStatement.Unprepare;
Helen
>I'm just playing around with the onprepareSQL events of IBOquery andYes, if you make the datasets active during FormCreate. This isn't good
>IB_query.
>Am I right, that both are firing during the form create event (which is also
>establishing the above query components)?
client/server practice anyway, and is a relic of the BDE and Paradox.
>Is there a safe way to prevent this preparation?Yes. Don't open datasets until you are ready to have them open. The Open
call (or setting a dataset to Active, which is another nasty relic from
Paradox) requires the statement to be prepared. So, if you tell your app
to open a dataset, it will automatically test for Prepared and, if it's not
prepared, it will call Prepare.
>I'd like to set someFollow the recommended order for opening your datasets.
>sqlwhereitem modficitations, which are not available on form creation time,
>but later before the form shows up.
>To speed up things, the first automated prepare is useless and I'd like to
>avoid it. The prepare should happen on the query actication or can be done
>manually by my program in formshow.
For OnPrepareSQL to work, the dataset must be in the unprepared
state. Modifying SQLWhereItems and/or SQLOrder of course changes the
specification of the dataset so the Unprepare should occur automatically
when you call SQLWhereItems.Clear or SQLOrder.Clear. For DML statements,
it's wise to be a little more particular, and test for Prepared yourself.
if MyStatement.Prepared then MyStatement.Unprepare;
Helen