Page 1 of 1

Update in memory records

Posted: Fri 23 Jan 2009 23:34
by Stef Merlijn
Hello,

Can you please explain to me how I can accomplish the following?

1. At start-up of my application I load serveral tables in memory.
These tables are used for LookupComboBox-fields.
2. All changes to databasetables will be recorded in a log-table
showing tablename, username and change-datetime
3. Application will run SQL (Threaded Timer) in order to determine
tables that were changed after last check and will ideally only retrieve
changed records (based on last change DateTime of records).

Example:
Databasetable MyTableA contains 3 records
- 1 name1
- 2 name2
- 3 name3

MyTableA is loaded into Memory_MyTableA + LastReload-DateTime is recorded

MyTableA is changed.
- 2 newname 23-01-2009 12:30
Log-table entry is added
- 23-01-2009 12:30 MyTableA User1

Application will retrieve changed records from MyTableA
- 2 newname 23-01-2009 12:30

MyTableA is updated
- 1 name1
- 2 newname
- 3 name3

Is there a way to remove, add and update records in memory based on retrieved changes from database (see 3)? In other words is it possible to limit networktrafic and not load all records when some table is changed?
Do you have some best practice for this kind of situation? How to set it up?

Thanks, Stef

Posted: Mon 26 Jan 2009 08:58
by Plash
You can call the RefreshRecord method for a changed record.

Note that TVirtualTable does not have this method. It is available for normal tables such as TOraTable, TMSTable, etc.