This is a specific scenario. What I need to achieve is this:
- If someone insert or delete one or more rows in a specified table outside my application's UI, then it should detect that the table was modified.
- It should not use triggers.
This is what it not need to do:
- Differentiate if it was deleted or inserted.
- Detect who did the alteration or where it was altered.
- If the user do the same number of inserts and deletes at the same time. That can technically be counted as alterations and so, don't need to be detected as inserts and deletes.
This is what we think could do the job:
Create a table that will store the watched table name, the number of rows it have and a validation key, let's call integrity_tbl
. After inserts or deletes, update the number of rows and validation key. Only update the count of rows if validation key is valid. Invalidate the validation key every time the comparison fails. When data integrity verification is needed, count rows in table and compare to integrity_tbl
.
Do you think this is a good approach or should we try something else?
We are using Delphi and Firebird for this. As asked, we are using IBX to connect to Database. But the logic is the problem not the way to access the database.