Subject | Re: [IBO] Questions about transactions and generators |
---|---|
Author | Rafael Colucci |
Post date | 2004-05-22T20:04:41Z |
Ok.. but I have some threads that will insert at the same time. This code
will work?
procedure TForm1.Button1Click(Sender: TObject);
var
vId : Integer;
begin
IB_Query1.GeneratorLinks.Add('MyTablePK=genMyTable');
vId := IB_Query1.Gen_ID('genMyTable', 1);
IB_Query1.ExecuteDML('insert into MyTable(''Name'') values(''rafael'')');
end;
vId is the id that will be inserted in MyTablePK?
will work?
procedure TForm1.Button1Click(Sender: TObject);
var
vId : Integer;
begin
IB_Query1.GeneratorLinks.Add('MyTablePK=genMyTable');
vId := IB_Query1.Gen_ID('genMyTable', 1);
IB_Query1.ExecuteDML('insert into MyTable(''Name'') values(''rafael'')');
end;
vId is the id that will be inserted in MyTablePK?
> At 10:05 AM 21/05/2004 -0300, you wrote:Transaction.CancelAll
> >Hello
> >
> >What´s the difference between Transaction.Rollback and
> >?you
>
> 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 youset as
> 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
>___________________________________________________________________________
> 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 orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>