Subject Re: [IBO] Prepared and unprepared
Author Svein Erling Tysvaer
Hello Tim, I'm just adding a little bit to what Helen said (she said the
important bits, this is just details).

At 08:36 30.06.2003 +0200, you wrote:
> if not TIB_Transaction.InTransaction then
> TIB_Transaction.Commit;

I'm used to commit a transaction when I've done what I want to do, not
check and commit when another task initiates (though I'm not saying this
neccessarily is wrong).

> if active then close;

Queries live within a transaction, so all queries within your
TIB_Transaction will be closed when calling commit.

> if not TIB_Transaction.InTransaction then
> TIB_Transaction.StartTransaction;
> ParamByName('Param_1').AsWhatever := Var_1

OK, but calling ParamByName will start the transaction (unless started) and
prepare it.

> if not prepared then
> Prepare;

Prepare has to be done before using ParamByName. You've escaped since IBO
does it automatically if you do not do it.

> Open; (or execSQL or whatever)
> First;

I think calling Open will go to the first record anyway. Myself, I'm
calling Open if dealing with a TIB_Query and First if a TIB_Cursor - I
never do both.

HTH,
Set