Subject | SV: SV: [IBO] Refrasing my question about TIBOTable (prettyprinted) |
---|---|
Author | Jacob Havkrog |
Post date | 2011-05-16T19:26:35Z |
Thanks!
My triggers and the rest of the database generation script is produced by a datapump Delphi app, that I didn't write myself.
I'll change the trigger generation code!
In relation to this I have another question. The datapump app generates this SEQUENCE script code:
SELECT MAX(AddressNo) FROM ADDRESS
CREATE SEQUENCE AddressNo_ADDRESS_GEN
SET GENERATOR AddressNo_ADDRESS_GEN TO 180;
I'm just wondering if there is a bug here? The AddressNo generator is initialized to 180, which is the max AddressNo from my BDE database I'm pumping from. It works fine, but what's the point of the first part of the script code "SELECT MAX(AddressNo) FROM ADDRESS"? It looks wrong to me.
Jacob
Fra: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] På vegne af Helen Borrie
Sendt: 16. maj 2011 20:43
Til: IBObjects@yahoogroups.com
Emne: Re: SV: [IBO] Refrasing my question about TIBOTable (prettyprinted)
At 04:15 AM 17/05/2011, Jacob Havkrog wrote:
Helen
My triggers and the rest of the database generation script is produced by a datapump Delphi app, that I didn't write myself.
I'll change the trigger generation code!
In relation to this I have another question. The datapump app generates this SEQUENCE script code:
SELECT MAX(AddressNo) FROM ADDRESS
CREATE SEQUENCE AddressNo_ADDRESS_GEN
SET GENERATOR AddressNo_ADDRESS_GEN TO 180;
I'm just wondering if there is a bug here? The AddressNo generator is initialized to 180, which is the max AddressNo from my BDE database I'm pumping from. It works fine, but what's the point of the first part of the script code "SELECT MAX(AddressNo) FROM ADDRESS"? It looks wrong to me.
Jacob
Fra: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] På vegne af Helen Borrie
Sendt: 16. maj 2011 20:43
Til: IBObjects@yahoogroups.com
Emne: Re: SV: [IBO] Refrasing my question about TIBOTable (prettyprinted)
At 04:15 AM 17/05/2011, Jacob Havkrog wrote:
>Hi - you are right, the generator AddressNo_ADDRESS_GEN is called twice, once because of the GeneratorLinks, and once by the trigger AddressNo_ADDRESS_TRIG.You should *always* write your triggers for auto-generated keys that way. ALWAYS - regardless of whether you are using IBO or any other application interface.
>
>Now I'm wondering, is the alternative trigger below the right way to do it? Is this the way create a new record in a table and knowing the value of the automatically generator primary key?
Helen