|Subject||Re: [IBO] A Few Simple Questions|
> 1. What overhead is involved in a close and open of TIB_Query? TheIt is the prepare phase that is most costly - and even that is not too
> reason I ask this is I noticed in some of the examples supplied with
> IBO that when scrolling a master dataset, the detail dataset(those
> in tabs not visible at the time) are closed. The reason I ask this
> is I always thought that opening and closing datasets, especially
> remote, would be time and resource consuming.
bad after the first time, because IBO caches the relevant information.
Close does not necessarily unprepare the dataset and so openning again
is not necessarily that expensive. You will notice lots of provisos,
because the actual results depend on other facts, such as whether you
have AutoFetchAll enabled on a large dataset etc.
Generally the closing a dataset when a tab is not visible simply makes
it faster to scroll the main dataset - because there are less details
to keep in sync.
In my own apps I generally dont even prepare a dataset until the tab
showing the data becomes visible. However I usually dont bother
closing the dataset again, since in my own situations I expect it will
be likely the user is coming back. Exactly what you need to do
depends a great deal on what the application needs to do.
> 2. In most of these examples I could not find a place where datasetsYou will generally find that the automatic close is done via the
> where explictly closed when the app was closed. Either they are
> closed in the base form(which Jason makes plenty use of), or they
> are automatically closed????
transaction. For example in the IBO base form you have...
ModalResult := BaseTransaction.CloseWithConfirm;
CanClose := ModalResult = mrOk;
Also the destruction of the various components will cancel out any
Commit, rollback or close of a transaction will automatically
post/cancel/close all associated datasets.
Note that cancelling a dataset edit or insert has no impact on the
server itself, because edit / insert modes are purely a client
feature. The server does not know about them until they are posted.
So the only server interaction during close is rollback of an
> 3. I also noticed that refresh's on datasets are done primarily whenI am not sure if I understand this question. But try this...
> dataset operations(ie Updates etc) are done directly on the server
> and not in the client dataset buffers. I suppose it makes sense that
> if a user is updating the server via the client buffer, a refresh is
> not necessary?????
When you post an insert or edit to the server there may be trigger
operations that take place which alter other fields on that record.
So it may be necessary for IBO to re-read the record after it is
posted in order to see those changes.
Generally this interaction is controlled via the BufferSyncroFlags
(telling IBO if it will need to reread the record). However when the
record contains a blob field then the refresh of the record is ALWAYS
performed, because the blobid stored in the record will have changed.