Subject Re: [IBO] Re: Problem with triggers
Author L.M. Bemmelmans
Eric,

As Helen mentioned the trigger will always fire, so the only solution would
be that your "where clause" doesn't match a corresponding record (no
accountid matching in userinfo). Did you try to change "position" to a
larger number yet (making sure the trigger fires later in time/order )?

Leon



""Eric Tishler"" <etishler@...> wrote in message
news:9211DBA76BE969418E127E8F8C718C5815C5DF@......
> Once again this is valuable input. I will reverse the order and try again.
>
> The trigger itself is extremely simple and similar to my application
operates on a table not a view.
>
> The trigger, is as follows ...
>
> Both UserInfo and UserAccounts are tables.
>
> Name: UserAccounts_AU For Table: UserAccounts
> Action: After Insert: Update: X Delete:
> Position: 0 Is Active: X
>
> AS
> BEGIN
> Update "UserInfo"
> SET "UserInfo"."UserCredits" = NEW."Credits"
> WHERE "UserInfo"."AccountID" = NEW."AccountID";
> END
>
> Basically all the trigger does is ensure that the UserCredits field in the
UserInfo table is updated with the same value as Credits for the UserAccount
table when the UserAccounts table is updated.
>
> The trigger seems to take affect if I manually edit the UserAccounts table
and update the Credits field. The UserCredits field in UserInfo is update.
>
> However when I do this via my code the trigger does not seem to fire ...
>
> Per Helen's suggestion I will reverse the order of the transaction and
prepare testing and report back shortly.
>
> Thanks kindly,
>
> Eric
>
> Eric Tishler
> Software Architect
> Resolute Partners, LLC
> Phone: 203.271.1122
> Fax: 203.271.1460
> etishler@...
>
> -----Original Message-----
> From: Helen Borrie [mailto:helebor@...]
> Sent: Monday, April 05, 2004 8:56 PM
> To: IBObjects@yahoogroups.com
> Subject: RE: [IBO] Re: Problem with triggers
>
> At 04:09 PM 5/04/2004 -0400, you wrote:
> >Hi Marco,
> >
> >
> >I am using a TIB_DSQL object and the ExecSQL method as follows:
> >
> > // run the UPDATE
> > if not DataAccessMod.IBODQuery.Prepared then
> > DataAccessMod.IBODQuery.Prepare;
> > if not DataAccessMod.IBODQuery.IB_Transaction.Started then
> > DataAccessMod.IBODQuery.IB_Transaction.StartTransaction;
> > DataAccessMod.IBODQuery.ExecSQL;
> > DataAccessMod.IBODQuery.IB_Transaction.Commit;
>
> The sequence is wrong here. The transaction test has to precede the
> Prepared test. If the query needs to be prepared, it won't prepare if
it's
> not in a started transaction.
>
> To repeat what Marco said - the client side does not --- can not --- have
> any influence over whether a trigger fires or not.
>
> If you eliminated the possibility that the after trigger finds no records
> to operate on, then the next thing to look at is the possibility that, in
> one case, the DML is operating on the table and, in the other, it is
> operating on a view. If it's a view, the table triggers won't fire; if
> it's a table, the view triggers won't fire.
>
> Helen
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
>
>
> _____
>
> Yahoo! Groups Links
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> * To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
<mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://docs.yahoo.com/info/terms/> Service.
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>