Subject | Re: [firebird-support] Delphi + Firebird specific |
---|---|
Author | Daniel Rail |
Post date | 2004-03-11T11:37:24Z |
Hi,
At March 11, 2004, 05:41, Uwe Oeder wrote:
When do you notice the correct MasterID value? Directly after the
Append? Or after a post and commit?
Most of the component sets send the data only after a post and commit,
not when calling Append. And, the trigger is only executed on the
server when the INSERT statement is executed.
--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)
At March 11, 2004, 05:41, Uwe Oeder wrote:
> If this forum is not the right one to answer my question would somebodyWhich component set are you using?
> then please redirect me to the correct messagebord.
> I have 2 tables one is the master one the slave. When I insert a record
> into the master record everything is file. It calls the appropirate trigger
> and the records is assigned a unique identifier for its primary key through
> a generator.
>
> DtSrcMaster.DataSet.AppendRecord([0,TheName,TheDescription]) ;
> So far so good. This is the trigger.
> CREATE TRIGGER TrigGenWhitePage FOR Whitepage
> ACTIVE BEFORE INSERT POSITION 0
> AS
> BEGIN
> IF ((NEW.WpIDSQ = 0) OR (NEW.WpIDSQ IS NULL)) THEN
> NEW.WpIDSQ = GEN_ID(GenWhitepage,1) ;
> END !!
> Then I immediately query the current master record for its primary key so I
> can link the child record to the master record.
> MyVariant := DtSrcMaster.DataSet.FieldByName('MasterID').AsVariant ;
> However the master always reports back the value which I send with the
> append record procedure call , in this case 0. So the child records
> insertion fails as the link to the master record is false. Yet the master
> record is inserted into the table with the correct MasterID which is not 0.
When do you notice the correct MasterID value? Directly after the
Append? Or after a post and commit?
Most of the component sets send the data only after a post and commit,
not when calling Append. And, the trigger is only executed on the
server when the INSERT statement is executed.
--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)