Subject | Re: [firebird-support] Re: generators |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-05-14T18:51:34Z |
Luiz Rafael Culik Guimaraes wrote:
If you want a consistent value (I don't think a reason why you could
want an inconsistent value) you should get the generator before you send
the insert, and suplly the generator value on your insert, Or you could
after the post search the Table on another unique column for the PK
(feed by the Generator) value.
The common aproach is, get the generator value and put it on your PK in
your client application.
As generator are outside transaction control, when you get the value you
will perhaps get the value already changed by others.
There is a feature that are being developed that will make it easier and
avoid a two statments to be sent to the server, that is :
insert into aTable (ColumnA, ColumnB, ColumnC) values (a, b, c) returns
(or returning don't remember exactly) ColumnA
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>Dear FriendsLuiz,
>
>Complementing previus email;
>Or an stored procedure would be better to get the last value generated by
>an generator. this this is better, any one has such procedure to share
>
>Regards
>Luiz
>
>
If you want a consistent value (I don't think a reason why you could
want an inconsistent value) you should get the generator before you send
the insert, and suplly the generator value on your insert, Or you could
after the post search the Table on another unique column for the PK
(feed by the Generator) value.
The common aproach is, get the generator value and put it on your PK in
your client application.
As generator are outside transaction control, when you get the value you
will perhaps get the value already changed by others.
There is a feature that are being developed that will make it easier and
avoid a two statments to be sent to the server, that is :
insert into aTable (ColumnA, ColumnB, ColumnC) values (a, b, c) returns
(or returning don't remember exactly) ColumnA
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br