Subject | Re: Detecting Database Changes |
---|---|
Author | joeacunzo |
Post date | 2004-01-11T00:33:44Z |
--- In firebird-support@yahoogroups.com, Alexandre Benson Smith
<iblist@t...> wrote:
<iblist@t...> wrote:
> At 01:18 09/01/2004 +0000, you wrote:given
>
> >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
> >the Firebird Embedded version that allows a database to be openapproach
> >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
> >requires file-level access to the database file, which I may nothave
> >in a multi-user setup.header
> >
> >2. I was also looking at the header checksum and the header
> >generation fields, but can I read those somehow? Also, is the
> >guaranteed to be updated if a table gets updated?in
> >
> >3. Lastly, I was thinking about having a trigger update a counter
> >a user defined table. But how do I guarantee that trigger getsfired
> >each time the database is opened by any application (is there somesimulating
> >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.
>
>
> Hi Joe !
>
> I have read a good article by Ivan Prenosil sometime ago about
> an On Connect trigger by some hacks on isc4.gdb, take a look at thisyou will
>
> http://www.volny.cz/iprenosil/interbase/ip_ib_isc4.htm
>
>
> Did you say about multi-user enviroment and FB Embebbed, I supose
> have diferent scenarios right ?help that
>
> You could revoke update to tables and grant only to SP's this can
> only your code modify the table data.contents.
>
> You could encrypt the data, so nobody can read or update the table
>since one
> I suppose that the control you want is nothing so sophisticated
> of your thoughts is to store the counter/timestamp/etc in a INIfile, so I
> think these very simple sollutions can help.around
>
> If you just want to know and do not mind if someone else is messing
> with your data, you could put triggers on insert, delete, updatefor all
> tables that logs the last time something was changed to a "logtable" and
> when your application starts compares the timestamp stored inyour "log
> table" with the timestamp of the last time your application run(finalized)
> stored somewhere else.user" to
>
> If you want something very very very simple to prevent a "basic
> modify your data direct with isql for example you could put atrigger on
> before insert, delete, update to check if a value in some flagtable is set
> and if not abort the statement. When your application starts setthe flag
> to true, when closes sets it to false. As you can see not "rocksolid" ;-)
> but can help a little bit. I think the time spent in some solutionmay
> depend on the importance of someone messing with your data.
>
>
> HTH
>
>
> Alexandre Benson Smith
> Development
> THOR Software e Comercial Ltda.
> Santo Andre - Sao Paulo - Brazil
> www.thorsoftware.com.br
>
> ----------
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.558 / Virus Database: 350 - Release Date: 02/01/2004
>
>
> [Non-text portions of this message have been removed]