#1 2015-02-27 08:31:28

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

History settings

Hello again,

Questions about history:
1. How to delete some history records?
2. If TSQLRecord was deleted from database, how I can determine it ID to get history for this record?
3. If database was opened first to store 100 rows, after this if I open it to store 10 rows in history
what occured with previously saved records, if they count already more than 10?
4. This is possible to change history depth on the fly for database?
5. This is possible to clear history depth for whole database for example up to 10 history item per record?
6. Not actual for me now, but for the future: if I add property in my TSQLRecord than I lost all previous history?
How to prevent this? How to store this history manually before I will lost it?

Offline

#2 2015-02-27 10:55:55

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

Re: History settings

1. Work directly on the history table, via regular ORM commands.

2. There is a flag stored in the history table for deleted records.
But you have to write a manual query yet in the history table to retrieve deleted IDs.
In fact, I suspect this ID would most probably be stored elsewhere in your database.

3. I do not understand the question, sorry.

4. Yes, AFAIK TSQLRestServer.TrackChanges() works on the fly.
But be aware not to disable then renable it, since history data may become inconsistent (as written in the method doc).

5. There is no such method for this yet - see point 1.

6. In current implementation, yes, TSQLRecordHistory.HistoryOpen() will just void any previous stored history, if the TSQLRecord layout changed (e.g. fields added or renamed).
This is due to the fact that the stored BLOB binary data is optimized for size and speed, so the field layout is expected to be fixed, and matching the current TSQLRecord.
I suspect that you can define a new history table for the updated TSQLRecord, then use the older history table for the previous content... Perhaps not very convenient...

Offline

#3 2015-02-27 15:11:38

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: History settings

Question 3 is about if I setup TrackChanges to 100 history depth, and after this to 10 depht.
In this situation if I change record wich have more than 10 records in history, will be deleted all except last 10?

Offline

#4 2015-02-27 17:10:14

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

Re: History settings

That's the idea.

Offline

#5 2015-03-09 21:11:59

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Re: History settings

Hi again, this idea can be implemented?
Also I need functionality to store in history the user name, which perform corresponding operation
where the right place to put this code?

Edit: or similar question - how to determine session (and user name) from OnUpdateEvent

Last edited by EgorovAlex (2015-03-10 16:09:24)

Offline

Board footer

Powered by FluxBB