Subject | Re: [ib-support] Interbase Transactions |
---|---|
Author | Helen Borrie |
Post date | 2000-12-15T09:42:34Z |
Ali,
The 'if NULL' test on the key is necessary just for the requested case -
where you need to know what the key value for the new ros will be before
the row is committed to the database. The NULL test ensures that, if you
already have the generator value for that key column, then the trigger will
not fire AGAIN upon in the BEFORE INSERT trigger. To do so would "wasting"
the number fetched by the application. It would also possibly make orphans
out of any detail rows that are dependent on the first value.
Do you understand that there is no dependency between the generator and the
column?
Do you understand that (unlike MSSQL IDENTITY values or AUTOINC types),
generators are NOT subject to transaction control?
Helen
At 10:35 AM 15-12-00 +0200, you wrote:
InterBase Developer Initiative · http://www.interbase2000.org
_______________________________________________________
The 'if NULL' test on the key is necessary just for the requested case -
where you need to know what the key value for the new ros will be before
the row is committed to the database. The NULL test ensures that, if you
already have the generator value for that key column, then the trigger will
not fire AGAIN upon in the BEFORE INSERT trigger. To do so would "wasting"
the number fetched by the application. It would also possibly make orphans
out of any detail rows that are dependent on the first value.
Do you understand that there is no dependency between the generator and the
column?
Do you understand that (unlike MSSQL IDENTITY values or AUTOINC types),
generators are NOT subject to transaction control?
Helen
At 10:35 AM 15-12-00 +0200, you wrote:
>Hi Svein,All for Open and Open for All
>i'm using alot of before insert triggers without null control and there
>is no problem
>& I saw IB Server validation check procedure never calls this trigger if
>there is an error.
>>----- Original Message -----
>>From: <mailto:svein.erling.tysvaer@...>Svein Erling Tysvær
>>To: <mailto:ib-support@egroups.com>ib-support@egroups.com
>>Sent: Friday, December 15, 2000 10:26 AM
>>Subject: Re: [ib-support] Interbase Transactions
>>
>>I believe this was a Before Insert trigger, which simply says that if no
>>value for IDFIELD has been generated, then generate one. So Helen's code is
>>just fine.
>>
>>Set
>>
>>At 10:11 15.12.2000 +0200, you wrote:
>> >>>>
>> >...
>> > IF ((NEW.IDFIELD IS NULL) OR (NEW.IDFIELD=0)) THEN
>> > NEW.IDFIELD = GEN_ID(THEGENERATOR, 1);
>> >...
>> >
>> > Helen
>>
>>Helen,
>>a field needs a generator will be unique, unique fields can't be null or
>>duplicate
>>so that,
>>if the field is null
>> then this trigger never called. ( becouse cant pass the validation
>>check )
>>else
>> 'NEW.IDFIELD IS NULL' control is an garbage command and make busy our
>>IB uh?
>> ( and inc. our code of course too )
>>
>>am i wrong ? ( sorry about my ugly english )
>>
>>eGroups Sponsor
>><<http://rd.yahoo.com/M=102308.1038796.2731130.908943/D=egroupmail/S=17000
>>077>http://rd.yahoo.com/M=102308.1038796.2731130.908943/D=egroupmail/S=170
>>00077
>>09:N/A=466331/?<http://features.yahoo.com/webceleb/carrey/>http://features
>>.yahoo.com/webceleb/carrey/>Click Here!
>>
>>To unsubscribe from this group, send an email to:
>>ib-support-unsubscribe@egroups.com
>>
>>
>>
>>
>>
>><<<<
>>
>>
>>
>>
>>
>>
>>
>>To unsubscribe from this group, send an email to:
>>ib-support-unsubscribe@egroups.com
>>
>>
>>
>>
>>eGroups
>>Sponsor<http://rd.yahoo.com/M=102308.1038796.2731130.908943/D=egroupmail/S
>>=1700007709:N/A=466331/?http://features.yahoo.com/webceleb/carrey/>
>>
>>To unsubscribe from this group, send an email to:
>>ib-support-unsubscribe@egroups.com
>>
InterBase Developer Initiative · http://www.interbase2000.org
_______________________________________________________