#1 2014-05-08 14:07:05

ComingNine
Member
Registered: 2010-07-29
Posts: 294

How to have an archived table besides a normal one, with one TSQLRec ?

If the number of the records gets larger (than 1000), it seems useful to move the records that are three days old from one table into another table (as an archive). Could you help to comment whether it is possible to implement this situation with one TSQLRecord descendant, instead of one TSQLRecordActive and one TSQLRecordNonActive with identical properties ? big_smile

(PS: Maybe it is not possible because ORM applies strict relation between class and table, as seen from this link http://stackoverflow.com/questions/8018597/)

Last edited by ComingNine (2014-05-08 14:19:18)

Offline

#2 2014-05-08 16:56:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: How to have an archived table besides a normal one, with one TSQLRec ?

If you inherit from any TSQLRecord like this:

  TSQLMyTableArchived = class(TSQLMyTable);

it will create a new class, so a new table.

Add both classes in the model, then you can easily move data from TSQLMyTable into TSQLMyTableArchived, with a CreateAndFillPrepare() + CopyValues() + BatchAdd()

Offline

#3 2014-05-08 17:23:48

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: How to have an archived table besides a normal one, with one TSQLRec ?

Thank you for your helpful comments very much ! This should work !

Offline

Board footer

Powered by FluxBB