Subject | Re: [IBO] Setting Parameters on before open in TIBOQuery |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-04-12T08:44:45Z |
At 07:47 PM 11-04-02 +0000, you wrote:
tell you that the published events for TIBOQuery are no different from
TQuery and call for a sequence like this:
If dataset is open, close it.
(You will do this on a button-click or some other user-initiated even.
If dataset is not prepared, then prepare it. (Again, part of the
user-initiated sequence).
Apply new values to parameters. (This is often done in BeforeOpen for
datasets, BeforeExecute for DML, but you can keep it in your buttonclick
event if this is a "straight-swap" operation that is always scoped within
this single user event. If it has to apply every time the query is to be
opened, then use BeforeOpen).
Open the dataset. (The call to Open() should be done as part of the
user-initiated sequence.)
The BeforeOpen event will fire just before Open() happens. (It will also
fire during the sequence of events when Refresh() is called: this is
because IBO implements Refresh appropriately for all datasets, not just
tables as the VCL does. ) You shouldn't ever call Open() from the
BeforeOpen handler, since by the time this event fires, the Open() sequence
is already in train.
I know how easy it is to get bogged down on these conversions. I guess you
are using the debugger, but ShowMessage() can be very useful when working
through these events; and use an IB_MonitorDialog so that you can watch
what is actually happening at the API. That will help more than anything
else to pinpoint the places in your code where each thing happens. The
reason Showmessage() helps is that you can just move an idiot message
around and have it wait modally for 'OK' whilst you look at the monitor. I
find this is less disruptive than breakpoints for this kind of
monitoring...but it's an augmentation of technique, not a substitute for
proper debugging.
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
>Hi All,Without being able to tell you every event in its allotted order, I can
>
>Delphi 5 Ent, Interbase 6.0.1.6, IBO 4.2.b
>
>I am finally getting to convert my BDE based application to use IBO.
>
>I am having difficulty in this part of the conversion.....
>
>I was using the (BDE) TQuery and setting a parameter in the Before
>open event:
>
>AQuery.Parabyname('value').asinteger := 123;
>
>but using the TIBOQuery with the before open event, the value is not
>used (no results returned), unless I set an explicit open too:
>
>AQuery.Parabyname('value').asinteger := 123;
>AQuery.Open;
>
>What event should I use to set the Parameter in the Query, without
>adding another open?
>
>The order of events seems to be different from the BDE - What is the
>IBO order of events when you use the IBOQuery?
tell you that the published events for TIBOQuery are no different from
TQuery and call for a sequence like this:
If dataset is open, close it.
(You will do this on a button-click or some other user-initiated even.
If dataset is not prepared, then prepare it. (Again, part of the
user-initiated sequence).
Apply new values to parameters. (This is often done in BeforeOpen for
datasets, BeforeExecute for DML, but you can keep it in your buttonclick
event if this is a "straight-swap" operation that is always scoped within
this single user event. If it has to apply every time the query is to be
opened, then use BeforeOpen).
Open the dataset. (The call to Open() should be done as part of the
user-initiated sequence.)
The BeforeOpen event will fire just before Open() happens. (It will also
fire during the sequence of events when Refresh() is called: this is
because IBO implements Refresh appropriately for all datasets, not just
tables as the VCL does. ) You shouldn't ever call Open() from the
BeforeOpen handler, since by the time this event fires, the Open() sequence
is already in train.
I know how easy it is to get bogged down on these conversions. I guess you
are using the debugger, but ShowMessage() can be very useful when working
through these events; and use an IB_MonitorDialog so that you can watch
what is actually happening at the API. That will help more than anything
else to pinpoint the places in your code where each thing happens. The
reason Showmessage() helps is that you can just move an idiot message
around and have it wait modally for 'OK' whilst you look at the monitor. I
find this is less disruptive than breakpoints for this kind of
monitoring...but it's an augmentation of technique, not a substitute for
proper debugging.
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