Subject RE: [firebird-support] Re: Auto Generate nos. but trigger won't work
Author Venus Software Operations
Hi Alan

Thanks for responding to my silly queries

At 03:27 pm 11/02/2004, you wrote:
>You don't request a new record from the server, you create a record insert
>statement at the client. You can ask the server for a new record PK though,
>first, then insert this new record you are constructing at the client with
>the requested PK value. You know after asking the server for this PK value
>that it will never be refused insertion to the DB since it has an
>unequivocal PK value. And it will never be handed out to anyone else.

Okay, I was under the impression that a new record place holder is there so
it should be having a PK filled in, my bad, sorry.


>generator values are generated outside all transaction control. You ask for
>and it's gone whether you use it or not, it's gone.. never to be returned to
>anyone else who askks for a generated value. This needs to be imutable in
>your design, don't go down the track of being tempted to reset generator
>values at your leisure or when you think you'd like to. That's the main
>reason why PK values should be meaningless to your app. Gaps in the running
>order of PK values are of absolutely no conseqence.

Yes that I am clear with, I expect gaps in generated IDs

>You would need to show us the trigger you are using. What you are describing
>is possible only if you are sending the server a value - not NULL - which is
>therefore not requesting a generated value since you have a not null if
>cluse on your trigger.
>let's see it.


The dependency tab for the table MACCOUNTS has the following:
Dependent: TRG_MACCOUNTS_IID_BI
Fieldl: IID


the following is the tables DDL:
create table MACCOUNTS(
IID integer not null,
IPID integer,
CNAME char(35) not null);

/* Primary Key */
alter table MACCOUNTS add constraint CON_MACCOUNTS_IID primary key (IID);

/* Foreign Key */

/* Indexes */

/* Triggers */
create trigger TRG_MACCOUNTS_IID_BI for MACCOUNTS active before insert
position 0
as
begin
IF (NEW.IID IS NULL) THEN
NEW.IID = GEN_ID(GEN_MACCOUNTS_IID,1);
end

/* Grants */



Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
venussoftop@...
venussoftop@...
venussoftop@...
venussoftop@...
vso_ad1@...
___________________________________________


Please note: We reserve complete rights for policy changes in the future
and the same will be applicable immediately as and when made. Attachments
may get corrupted before reaching you, in such a situation please let us
know and we will resend you the same at the earliest. We do not take any
responsibility for data loss of any type and kind. Data safety remains the
sole the responsibility of the users of our softwares.
___________________________________________

Internet email confidentiality:

This message may contain information that may be privileged or
confidential. If you are not the addressee nor are you responsible for the
delivery of the message to the addressee indicated in this email, then you
may not copy or deliver this email to anyone and you should notify the
sender by reply email and then destroy this message.

Please reply email immediately to this message with REMOVE in the subject,
if you or your employer do not consent to email of this kind.

Opinions, conclusions and other information in this message that do not
relate to the official business of my firm shall be understood as neither
given nor endorsed by my company.


----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 10/02/2004


[Non-text portions of this message have been removed]