Subject Re: [IBO] Questions about transactions and generators
Author Rafael Colucci
Ok.. but I have some threads that will insert at the same time. This code
will work?

procedure TForm1.Button1Click(Sender: TObject);
vId : Integer;
vId := IB_Query1.Gen_ID('genMyTable', 1);
IB_Query1.ExecuteDML('insert into MyTable(''Name'') values(''rafael'')');

vId is the id that will be inserted in MyTablePK?

> At 10:05 AM 21/05/2004 -0300, you wrote:
> >Hello
> >
> >What´s the difference between Transaction.Rollback and
> >?
> 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
> 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
> without the need for BDE, ODBC or any other layer.
> - your IBO community resource for Tech Info
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links