Subject | Re: [IBO] Re: How to use bookmarks like tTable and tQuery? |
---|---|
Author | Andrei Luís |
Post date | 2005-12-07T18:29:53Z |
Thomas,
I altered the trigger like u said, and set registro_id as not required
in IB_Query. The same behavior: After post, the pointer is at the
record it was before the insert comand.
I forgot to mention: Now I'm using generatorLinks property instead
trigger, and it's working like I need.
[]
Andrei
2005/12/7, Andrei Luís <compuvale.software@...>:
I altered the trigger like u said, and set registro_id as not required
in IB_Query. The same behavior: After post, the pointer is at the
record it was before the insert comand.
I forgot to mention: Now I'm using generatorLinks property instead
trigger, and it's working like I need.
[]
Andrei
2005/12/7, Andrei Luís <compuvale.software@...>:
> Is there any problem to use the trigger like I posted? Because it's a
> trigger only or Before Insert event...
>
> I tried to use triggers like u said when I was learning about Firebird
> + IBO, but, I was getting error messages in Delphi like "Registro_id
> is a required field and cannot be null", and so I suppres "IF
> (NEW.REGISTRO_ID IS NULL) THEN" and set registro_id to receive 0
> (zero) as default value in IBO.
>
> After I changed all my triggers and code like this, I heard about
> setting registro_id field to a not required field, but, sincerely, I
> didn't do any change...
>
> I will test and put the result here.
>
> []
> Andrei
>
> 2005/12/7, Thomas Steinmaurer <ts@...>:
> > > SET TERM ^ ;
> > >
> > > CREATE TRIGGER TRIG_AGENDA_BI_0 FOR AGENDA
> > > ACTIVE BEFORE INSERT POSITION 0
> > > AS BEGIN
> > > NEW.REGISTRO_ID = GEN_ID(GEN_AGENDA_REGISTRO_ID,1);
> > > END
> > > ^
> > >
> > > SET TERM ; ^
> >
> > Thought so. Extend that to:
> >
> > SET TERM ^ ;
> >
> > CREATE TRIGGER TRIG_AGENDA_BI_0 FOR AGENDA
> > ACTIVE BEFORE INSERT POSITION 0
> > AS
> > BEGIN
> > IF (NEW.REGISTRO_ID IS NULL) THEN
> > NEW.REGISTRO_ID = GEN_ID(GEN_AGENDA_REGISTRO_ID,1);
> > END
> > ^
> >
> > SET TERM ; ^
> >
> >
> > And you will be fine, because REGISTRO_ID won't get a new value again,
> > thus IBO will have the correct value of REGISTRO_ID for a newly inserted
> > record.
> >
> >
> > --
> > HTH,
> > Thomas Steinmaurer
> > LogManager Series - Logging/Auditing Suites supporting
> > InterBase, Firebird, Advantage Database, MS SQL Server and
> > NexusDB V2
> > Upscene Productions
> > http://www.upscene.com