Select to view content in your preferred language

Trigger on A and D table

478
1
04-20-2010 10:19 PM
tongkimongki
Emerging Contributor
Dear expert,

I want to see who has been editing data in my versioned Feature Class by applying trigger on A and D table. But I found some interesting things:

First off all i create a table "whoisediting" to store the username, feature being edited, editing time and stateid.

Say I have A65 and D65 and my triggers are :

CREATE OR REPLACE TRIGGER A65_after_insert AFTER INSERT ON sde.A65
FOR EACH ROW
DECLARE
v_username varchar2(10);
v_time varchar2(30);

BEGIN
SELECT user INTO v_username
FROM dual;
SELECT TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS') INTO v_time
FROM dual;

INSERT INTO sys.whoisediting (tabelname, username, time,stateid) VALUES ('fc1_insert', v_username, v_time,:NEW.SDE_STATE_ID);

END A65_after_insert;
.
run;

Then I do :

1. I start to edit my FC1 feature class via ArcMap. I draw a line (without clicking 'Stop Editing').
2. run this query 'select count(*) from whoisediting;' and It says there are TWO records.
3. I update one of the field
4. run this query 'select count(*) from whoisediting;' and It says there are FIVE records. [This means that UPDATING will add another 3 records in A table]
5. then I click 'Stop Editing' (and save the edit).
6. run this query 'select count(*) from whoisediting;' and It says there are SEVEN records. [This means that SAVING will add another 2 records in A table]

This happens when I add single object/record. I cant imagine editing a really huge data with many objects/record. This A table will really really explode....

My questions:
1. Why does this drawing/editing process add so many records to A table ? Isn't 1 record just enough (thats what it says in the training module)...?
2. How can I see who has edited/added data to my feature class ?

Thanks
0 Kudos
1 Reply
AJR
by
Frequent Contributor
1) - Only ESRI can answer as to why there are so many inserts into your Adds table (my guess is that it is part of the core design and has to do with the interaction between ArcObjects and SDE, but that is just a guess).
2) The approach you have taken (putting a trigger on the Adds table) will technically work to capture who is editing your data, but it is a tough thing to administer.  This has been covered multiple times in the old forums, try searching over there for the specifics (http://forums.esri.com/).  The highlights are you need to decode the registration id for the layer, and re-create the trigger each time the layer is unversioned/re-versioned.
0 Kudos