Subject Re: [IBO] IB_cursor and Append
Author Helen Borrie
At 01:14 PM 31/01/2003 +0000, you wrote:
>Only a doubt about IB_Cursor and IB_Query.
>Why IB_Cursor closes dataset when the Append method is called?

An IB_Cursor is not a buffered dataset - only the current row is contained
in the client, in the ib_cursor's Row buffer.

>with IB_Cursor do
> if not Prepared then
> Prepare;
> if not IB_Transaction.InTransaction then <--- THIS MUST BE DONE BEFORE
> IB_Transaction.StartTransaction;
> First;
> if Eof then
> //*** here Active = True
> Append;
> //*** here Active = False
> ...

When you call First to open the ib_cursor (which is the correct method to
call) then the cursor will be at EOF only if the set is empty. Therefore,
Append is the wrong method to call - it appends a new row following the
current row...but an empty set has no current row... call Insert.

>Meaning that the detail tables doesn't work on inserts.

ib_cursor is usually not a good one to use for detail sets because it is
not buffered, i.e. it will not scroll. It presents each row directly into
the row buffer, and when your application asks for another row, e.g. Next,
Last or First, it clears the row buffer, fetches the requested row and
refills the row buffer.

>Why it doesn't work like IB_Query that let dataset opened on insert

Because ib-query IS buffered and so you can scroll up and down from row to
row. If you reach the end of a scrollable dataset and move to the "next"
row, IBO will automatically append a new row to the buffer.