Subject | Detecting Database Changes |
---|---|
Author | joeacunzo |
Post date | 2004-01-09T01:18:48Z |
I've written a Windows application that uses Firebird v1.5. (Note:
I'm using C++ and the IBPP class wrappers.) I'm concerned about
someone using a different application or tool (e.g. isql.exe) to
modify the content of my database. This seems very easy to do given
the Firebird Embedded version that allows a database to be open
without needing a username/password.
Therefore, I'm looking for a technique to determine if my database
has been modified by another application. Here's what I've thought
of so far, all having some hurdle to get over:
1. I was thinking of storing the database file-time in a .ini file
and compare that before I connect to the database, but this approach
requires file-level access to the database file, which I may not have
in a multi-user setup.
2. I was also looking at the header checksum and the header
generation fields, but can I read those somehow? Also, is the header
guaranteed to be updated if a table gets updated?
3. Lastly, I was thinking about having a trigger update a counter in
a user defined table. But how do I guarantee that trigger gets fired
each time the database is opened by any application (is there some
update on a system-level table each time a database is opened)?
Using this technique, I could store the counter in a local ini and
compare it when I open the database.
Any and all input will be appreciated. Thanks!
Joe A.
I'm using C++ and the IBPP class wrappers.) I'm concerned about
someone using a different application or tool (e.g. isql.exe) to
modify the content of my database. This seems very easy to do given
the Firebird Embedded version that allows a database to be open
without needing a username/password.
Therefore, I'm looking for a technique to determine if my database
has been modified by another application. Here's what I've thought
of so far, all having some hurdle to get over:
1. I was thinking of storing the database file-time in a .ini file
and compare that before I connect to the database, but this approach
requires file-level access to the database file, which I may not have
in a multi-user setup.
2. I was also looking at the header checksum and the header
generation fields, but can I read those somehow? Also, is the header
guaranteed to be updated if a table gets updated?
3. Lastly, I was thinking about having a trigger update a counter in
a user defined table. But how do I guarantee that trigger gets fired
each time the database is opened by any application (is there some
update on a system-level table each time a database is opened)?
Using this technique, I could store the counter in a local ini and
compare it when I open the database.
Any and all input will be appreciated. Thanks!
Joe A.