Subject Re: [IBO] About post, commit, delete
Author Helen Borrie
At 03:39 PM 21/09/2003 +0000, you wrote:
>As I understant, post is used when dataset is edited or new records
>are inserted. Such code
>IB_Query->Insert();
>IB_Query->FieldByName( .... )->Assign( .... );
>IB_Query->Post();
>IB_Query->Refresh();
>doesn't insert new records into table (client see newly inserted
>records). I must commit in order to post new records into table?

Yes. If you call StartTransaction in your code then you are in explicit
transaction control and you must call Commit. But, if your transaction has
Autocommit true AND you don't call StartTransaction, then the commit will
happen automatically when you call Post. (StartTransaction disables
Autocommit).

If you set BufferSynchroFlags to include bsAfterInsert, then IBO should
take care of bringing the inserted row into the buffer. But it won't work
if your keylinks are wrong, or if IBO doesn't know the new PK of the
row. In that case a Refresh will be needed to make the new row visible.

>What to do in delete case (IB_Query->Delete() )?
>IBO help states, that commit closes dataset - I need to reopen

Just call Refresh. IBO will take care of closing and opening.

> then to
>see changes (prepare

No, don't call Prepare. IBO will prepare datasets if it is needed,
otherwise you make a lot of unnecessary work for your application
(unnecessary work = wasted time, slower performance)

> & then open)?

Only Refresh. After starting the transaction, of course.

Helen