#1 2013-08-07 17:08:37

lele9
Member
Registered: 2011-10-28
Posts: 170

TSQLRecordMany alternatives

hi ab,
in referring to this problem http://synopse.info/forum/viewtopic.php?id=1378
where is the suggested way to avoid TSQLRecordMany?
i read the documentation about neested object dynArray, tCollection and so on but in all example you never use another TSQLRecord inside.

i.e.
can i use TDynArray of packet record where one property is a TSQLRecord?

thanks,
Emanuele

Offline

#2 2013-08-07 17:50:47

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

Re: TSQLRecordMany alternatives

No, dynamic arrays are for records, i.e. value objects.

What is proposed in the documentation is to "normalize" the database (aka "data sharding"), i.e. do not rely on JOINed tables, but try to put all needed content in one table.

For instance, an invoice will be just one TSQLRecord class, with no external TSQLRecord for items in the invoice.
The items will be stored as a dynamic array within the record.

It is more object oriented (and less RDBMS driven), and a perfect path to NoSQL databases.
(by the way, I'm preparing direct persistence of objects in mORMot via MongoDB and not a SQL database... stay tuned!)

Forget about SQL, try to think about objects.

Offline

#3 2013-08-08 07:20:53

lele9
Member
Registered: 2011-10-28
Posts: 170

Re: TSQLRecordMany alternatives

yes i understand what you mean but not all data can be put in one TSQLRecord class.
for i.e. in my case i need to join TMySQLRecordMany and TSQLAuthUser (many to many relationship) so i can't do what you mean!

But i can't use TSQLRecordMany with another TSQLRecordMany as Source, i can't use dynamic array, what i can use to implement this situation?

Offline

Board footer

Powered by FluxBB