Subject Re: [IBO] Questions about transactions and generators
Author John Peterson
Helen,
So, to clarify my understangin of GeneratorLinks:
Where GeneratorLinks are used, IBO is using GenId() to grab the generator
value, then explicitly setting the PK columns value on the client side,
rather than relying on a GenId() in a BeforeInsert trigger to update the PK?

regards
John

----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Saturday, May 22, 2004 9:00 AM
Subject: Re: [IBO] Questions about transactions and generators


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




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links