cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Triggers Not Fireing

jamesfflagg
Explorer
0 Likes
589

I have made a bunch of After Update triggers on different tables that will write the table's PK into a log table through an execution of a stored procedure. The triggers work fine on all but one table. The table does not have the trigger turned off.

After some testing I found that if I have a dictionary connection to the table in Data Architect only then the tables trigger works fine but, if I open the application before opening Data Architect then the trigger fails.

I search throughout my code for sp_DisableTriggers and none are there. I did some more testing and I found that if I open the table in Data Architect first and leave Data Architect Open and then open my application then the trigger works fine. So there has be something our app is doing to the table causing the trigger to break. This is a multi programmer shop and I am not the original programmer who made this table but I double checked the code and it is opening it with a data dictionary connection and not as a free table.

I am at my wits end on this one and any help you can provide would be greatly appreciated.

Thanks,

Jim Flagg

Accepted Solutions (0)

Answers (2)

Answers (2)

joachim_drr
Contributor
0 Likes

That was my first guess, but you wrote earlier:

<snip>

I double checked the code and it is opening it with a data dictionary connection and not as a free table.

</snip>

so I didn't follow up. When opening a table ADS sets a marker for trigger support. If it's a free connection, there couldn't be any.

You get the same when opening a table without a trigger, then add some triggers to it. The triggers won't fire until the table file is closed and reopened.

jamesfflagg
Explorer
0 Likes

FYI,

We are using v12. After some testing and trial and error I found out what the issue is. I on a Remote Connection you open a table free (with out a add dictionary connection) and leave it open the triggers on the server for that table quit working for all subsequent connections to that table until the free connection is closed. I our app we were opening a free connection for some tables to handle specialized deletes that would not initiate any trigger/function/procedures on the table it is deleting from. I corrected the code to make sure it uses a dictionary connection but we might have different places throughput our code that will use a simple TAdsTable with no connection. We found that if we initially open a dictionary connection to all of our tables that have triggers and leave the connections open then this fixes the problem of free connection not allowing triggers to fire. It would be nice if the triggers fired even if someone had a free connection of the table open somewhere else.

Thanks,

Jim Flagg