#1 2017-09-28 09:40:53

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

Virtual table

Hi mORMot community,

We'd like to have a table on which we can use the ORM (SELECT and UPDATE), but part of the structure of the table need to be changed from the code (there is a fixed structure, TSQLFamily, in which the end-user can add/remove fields) so using a TSQLRecord is excluded (I guess?).
(to be simple, we actually have a TSQLFamily declared, and a TSQLFamilyUser with "FamilyID", "FieldName" and "FieldValue" <- very simplified)
As of right now, we are able to consolidate all those data in the client side, but the process is quite long and we can't SELECT or JOIN on it.

So I'm starting to look at TSQLVirtualTable, and I'd like to know if I'm going in the right direction?


IF I've correctly understood the doc, I need:
-Inherit a TSQLVirtualTable or TSQLRecordVirtualTableAutoID (let say TSQLVirtualFamily) and override GetTableModuleProperties and Structure (to be able to not use a TSQLRecord) and I guess
-Inherit a TSQLVirtualTableCursorIndex (TSQLVirtualFamilyCursor) and override at least Column and Search

and then register the table with VirtualTableRegister

How far am I from the truth? And more important, is this the right choice for what I'm trying to do?

Offline

#2 2017-09-28 17:53:10

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

Re: Virtual table

I would rather go into adding some TDocVariant published fields, which will be stored as JSON in the database.

Offline

Board footer

Powered by FluxBB