Subject | Re: [firebird-php] Re: using auto_number field |
---|---|
Author | Jean Lopes - TSA |
Post date | 2004-06-04T20:24:23Z |
Alan,
Yes, I ask the generator before, then I had the generator to use in master
record and details to create the foreign key.
But if you had a trigger before insert (for auto-inc) like new.cod_key =
gen_id(my_gen,1);
the filed cod_key will be updated a second time.
Jean Paul Lopes
Sócio-Gerente
TSA Tecnologia Sistemas e Automação Ltda.
http://www.tsa-sistemas.com.br
Rua Cel Sarmento, 1699 / 101
94010-031 - Gravataí - RS
Fone/Fax: 51 488.3608 / 3042.6084
Membro da Comunidade Firebird de Língua Portuguesa
http://www.comunidade-firebird.org
Fazendo o Firebird falar português
jean.lopes@...
Yes, I ask the generator before, then I had the generator to use in master
record and details to create the foreign key.
But if you had a trigger before insert (for auto-inc) like new.cod_key =
gen_id(my_gen,1);
the filed cod_key will be updated a second time.
Jean Paul Lopes
Sócio-Gerente
TSA Tecnologia Sistemas e Automação Ltda.
http://www.tsa-sistemas.com.br
Rua Cel Sarmento, 1699 / 101
94010-031 - Gravataí - RS
Fone/Fax: 51 488.3608 / 3042.6084
Membro da Comunidade Firebird de Língua Portuguesa
http://www.comunidade-firebird.org
Fazendo o Firebird falar português
jean.lopes@...
----- Original Message -----
From: "Alan McDonald" <alan@...>
To: <firebird-php@yahoogroups.com>
Sent: Friday, June 04, 2004 4:48 PM
Subject: RE: [firebird-php] Re: using auto_number field
> >remember that when you use trigger to implements auto-inc field, you
don´t
> >have control over the
> >value. It is a problem qhen you use master-detail relationships. In my
> >databases mny trigger had a
> >test. If de value of a auto-inc is null or 0 (zero) then get a new
> >enerator, othewise the aplication
> >get the generator first and, with the value "in hands", send it to
database
> >in the insert command. then
> >I had the key value for details.
>
> >Diferents problems requires diferents solutions. One touch wizzard always
> >resolves thr problems
> >in the same way.
>
> >Jean Paul Lopes
> >Sócio-Gerente
>
> Rubbish.. you just ask for the generated value before you insert. Then you
> have it for the detail records as well.
> ever seen
> SELECT GEN(MY_GEN, 1) FROM RDB$DATABASE
> ?
> Alan
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>