Subject | Re: [firebird-support] Display rows that have been updated recently |
---|---|
Author | Norman Dunbar |
Post date | 2011-07-29T08:01:06Z |
Morning Josh,
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. :-(
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
> Is there a way to find out if a row has been updated recently? Like aNo. At least, not that I know of myself.
> hidden time stamp somewhere?
> What I'm trying to do is do a select query on a table and display rowsHmmm. Helen will give your developer(s) grief if she finds out. This
> 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.
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