Subject | RE: [firebird-php] Re: using auto_number field |
---|---|
Author | Alan McDonald |
Post date | 2004-06-05T02:01:52Z |
no it won't because your trigger as a standard form should be
if (new.cod_key is null) then make a new one
Alan
-----Original Message-----
From: Jean Lopes - TSA [mailto:jeanlopes@...]
Sent: Saturday, June 05, 2004 6:24 AM
To: firebird-php@yahoogroups.com
Subject: Re: [firebird-php] Re: using auto_number field
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@...
if (new.cod_key is null) then make a new one
Alan
-----Original Message-----
From: Jean Lopes - TSA [mailto:jeanlopes@...]
Sent: Saturday, June 05, 2004 6:24 AM
To: firebird-php@yahoogroups.com
Subject: Re: [firebird-php] Re: using auto_number field
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@...
----- 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
>
>
>
>
>
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/
b.. To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]