Subject Re: [IBO] Questions about transactions and generators
Author Helen Borrie
At 10:05 AM 21/05/2004 -0300, you wrote:
>Hello
>
>What´s the difference between Transaction.Rollback and Transaction.CancelAll
>?

Transaction.Rollback operates on work that has already been posted to the
database: it submits a Rollback request to the server. CancelAll cancels
any work pending in your datasets that has not yet been posted. It won't
work in an AutoCommit transaction.

>IBO provides any way to get a ID of an inserted field, without use select
>gen_id(...) from rdb$database' ?

Using generators (unlike using auto-increment types that other RDBMS
provide) you can get the generator value at any time - including BEFORE you
post work to the server. IBO exploits this with GeneratorLinks. If you
set this property, IBO will fetch the required generator value before the
post, when you call the Insert method. Let's say your dataset is
displaying rows from a table whose primary key MyTablePK is populated by a
generator named genMyTable. Then the GeneratorLinks property should be set as

MyTablePK=genMyTable

Under the hood, GeneratorLinks uses a method named GenID(), which takes as
arguments a string (the name of the generator) and an integer (the step
value). You can also use GenID() directly yourself, at either connection
level or dataset level, to pull a generator value into a variable.

Tip: you can also "set up" auto-generation of ALL (or any) of your
generators at connection level, by listing them, with table qualifiers, in
the GeneratorLinks property of the connection object.

Helen