Subject Re: [IBO] Trigger don´t fires!
Author hugosan@redysoft.com
Lucas,
you're right; my trigger doesn't fire because it's BEFORE INSERT
and the insert happens on the client.
I changed the trigger and now it's AFTER INSERT, and now it fires OK.
Thanks for your suggestion about defaults. My purpose isn't setting
default values (it was just a sample),
but assigning values on another table, with master-detail relation.

I'll explain more:

CREATE TRIGGER MyTableTrigAI FOR MyTableMaster
AFTER INSERT AS
BEGIN
UPDATE MyTableDetail D
SET D.SomeDetailField=NEW.SomeMasterField
WHERE D.ID=NEW.ID;
END

Well, on my app I first insert some Detail records, then the
Master record, and then I commit the transaction (with both tables).
The problem is (I think) the order in which the posts are processed
on the server, because when the trigger fires, he doesn't still
find any Detail record, and the UPDATE don't works for my purpose.
Does this give you some hint?
Really can I to alter the order of processing INSERTS?
Very thanks,
Hugo.

--- In IBObjects@y..., Lucas Franzen <luc@r...> wrote:
>
> Hugo,
>
> look at the thread "IBO Help files" where I explained why a trigger
will
> NOT fire when setting a Query into the insert mode.
>
> If you want to fire the trigger you have to make a DUMMY INSERT,
Post
> it, re-fetch the record and then edit it.
>
> But I think you'd be better off with using the default values
properties
> of the Query.
>
> Luc.
>
> hugosan@r... schrieb:
> >
> > C++Builder 5, IBO 3.6C, IB 6.01
> >
> > Please listen to that trouble about triggers in IBO.
> > I have a TABLE with a TRIGGER BEFORE INSERT. Within my
> > IBO-CppBuilder application, the trigger don't fires!
> > Let me explain: the trigger contains some like this
> >
> > CREATE TRIGGER mytableTrigBI FOR MYTABLE
> > BEFORE INSERT AS
> > BEGIN
> >
> > MYTABLE.SOMEFIELD='Some text';
> >
> > END
> >
> > If I insert one record using IB Console, SOMEFIELD takes
correctly the
> > text I assign in the trigger. But with the app, where the table is
> > handled with a TIB_Query, I suspect the trigger don't fires
because
> > nothing is assigned to SOMEFIELD.
> > Is this possible?
> > Which property can cause this behaviour?
> > TIA
> > Hugo.
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/