#1 2021-05-14 12:04:01

wxinix
Member
Registered: 2020-09-07
Posts: 121

How to save dynamic array to TDocVariant?

var LData: TArray<Double>;

// LData is a dynamic array; its length is unknown at compile time.

_arr(LData) doesn't work.....

I am doing this because I want to save the array as string in database (not Blob).

Offline

#2 2021-05-15 10:49:24

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

Re: How to save dynamic array to TDocVariant?

You can use a temporary JSON conversion.

For mORMot 2, I have just added some overloaded TDocVariantData.InitArrayFrom() method including a TDynArray version, or an "array of double" input.

Offline

#3 2021-05-15 12:55:11

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: How to save dynamic array to TDocVariant?

ab wrote:

You can use a temporary JSON conversion.

For mORMot 2, I have just added some overloaded TDocVariantData.InitArrayFrom() method including a TDynArray version, or an "array of double" input.

Thank you very much.  I am using mORMot 1.18 on a new development (following the advice taht mORMot 2 is still not ready for production).

I am somewhat "concerned" - will mORMot 2 be significantly different?  Once started with mORMot 1.18 for a project, what should I do to maintain  the project in the long run?  Will 1.18 be deprecated once mORMot 2 is stable?

Offline

#4 2021-05-15 13:29:01

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

Re: How to save dynamic array to TDocVariant?

TL&WR
- mORMot 2 is entering its pre-release phase
- mORMot 1.18 is entering its freezing phase

mORMot 2 seems stable for its core process, like SOA or ORM.
The test coverage is as good as mORMot 1.18.
It is already used on production for some projects, and we will use it on our side - for https://www.tranquil.it/en/ - for a huge project in the next months.
Note that the latest features (like Zip64, OpenSSL...) are only par of mORMot 2, and are not likely to be pushed to mORMot 1.18 (unless someone proposes a patch with proper fixes).

Only some features were not converted yet from mORMot 1 to mORMot 2, like TDataSet clients or SynPDF.

So you can check which features you need. It is likely that mORMot 2 can be used for you.

Offline

#5 2021-05-15 14:47:18

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: How to save dynamic array to TDocVariant?

Oh Cool. Thank you very much.

Offline

#6 2021-05-17 20:03:26

mdbs99
Member
From: Rio de Janeiro, Brazil
Registered: 2018-01-20
Posts: 139
Website

Re: How to save dynamic array to TDocVariant?

ab wrote:

It is already used on production for some projects, and we will use it on our side - for https://www.tranquil.it/en/ - for a huge project in the next months.

One more interesting case for mORMot!

Offline

Board footer

Powered by FluxBB