Subject RE: [IBO] Re: Problem with triggers
Author Eric Tishler
Hi Marco,

Thank for your thoughts.

This database has been in place for two years now and the trigger has been working with no problems at all. So it is a tried and proven trigger with no recent modifications. I have seen it work perfectly in the normal case. That is the main application updates table 1 and the trigger ALWAYS updates table 2.

I just inherited this code a few months ago so I am just learning Firebird and Delphi.

This past week I had to write a small application to automate some data entry into the application database. My small application performs the updates to table 1 (same exact field as he large scale application does) but the trigger does not seem to happen, so the data is not updated in table 2.

Stranger still, I have the same database on two different machines. On the one local here in my lab it seems to work just fine. On the remote server (about a 1000 miles away and connected via the Internet) the trigger does not seem to fire when I run my small application. Yet when I perform a manual update to table 1 on the remote (using IB Manager) the trigger does fire and table 2 is updated. But, I do not know what the difference is between my application initiating the update on table 1 or me doing this via IB Manager.

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;


I appreciate your input, but my problem remains unresolved.

Best regards,
Eric

Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...

-----Original Message-----
From: Marco Menardi [mailto:mmenaz@...]
Sent: Monday, April 05, 2004 3:48 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: Problem with triggers

--- In IBObjects@yahoogroups.com, "Eric Tishler" <etishler@r...> wrote:
> I run a transaction that performs an update on a specific table.
What I am really doing is adding credits to a user balance. In the
database this table has an AU (After Update) trigger that should take
the updated balance and update a corresponding record in another table.
>
> For some reason the first table is getting update just fine from my
code. However the trigger does not seem to be kicking in and updating
the second table.
>
> Is there something else special I have to do from my code to ensure
that any associated triggers are invoked as is appropriate?
>
> I always thought that triggers are stupid and just react to events
and that that do not care if an Insert/Update/Delete takes place
directly in the database or through code. (A Delphi application in
this case using IB Objects)
>
There nothing you have to do from the client side to have triggers...
triggered. I suspect that you have a wrong designed or implemented
trigger.
I'm using the trigger logic also for account purposes and works very well.
a) make sure your trigger is fired: add an exception on it and see if
an exception is rised
b) make sure that your trigger code is correct (i.e. you are not
making an update with a search criteria that founds NO rows to update)

Best regards
Marco Menardi



___________________________________________________________________________
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]