Subject Re: [firebird-support] Display rows that have been updated recently
Author Norman Dunbar
Morning Josh,

> Is there a way to find out if a row has been updated recently? Like a
> hidden time stamp somewhere?
No. At least, not that I know of myself.

> What I'm trying to do is do a select query on a table and display rows
> that have been changed or added in the last hour or so. Unfortunately I
> can't add another date/time field to the table because there's and
> existing application that's dependent on the structure so I can't change it.
Hmmm. Helen will give your developer(s) grief if she finds out. This
sounds remarkably like they have done a "select * from some_table..."
instead of "select the,stuff,I,need from some_table...".

As you note, with this style of programming, you are effectively stuffed
when it comes to changing the table structure - unless you want to
rewrite the application and redistribute it every time you have to add a
column etc. :-(

> Any thoughts would be appreciated.
Given the above restriction, I'd say that you need to hold a "changes"
table for every table you want to monitor. This would have the PK of the
main table and a date/time when the change was made, possibly a "by who"
column as well. Then, on the main table, build a trigger that fires on
insert,update,delete and log the PK of the changed record, the who did
it, the date/time and, if necessary the action - I,U,D etc.

There will no doubt be other ways to achieve what you want, but this one
is what fell off the top of my head! (And I've only had one coffee so
far today!)

Cheers,
Norm.

PS. Did you resolve your connection problem in another post? Just wondering.

--
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767