#1 2022-08-11 10:03:03

squirrel
Member
Registered: 2015-08-13
Posts: 155

Migrating to mormot 2

Is there a document available which lists which units different declarations have moved to?  For example TDocVariantData moved from SynCommons to mormot.core.variants etc?

I am trying to find the location for TDocVariantData.InitFromTypeInfo and also busy making a list of common mormot types that I use a lot and where they are now to make migrating existing projects easier.

Offline

#2 2022-08-11 12:07:30

squirrel
Member
Registered: 2015-08-13
Posts: 155

Re: Migrating to mormot 2

What is the mormot 2 class for TSQLTableWritable called?

Offline

#3 2022-08-11 14:33:52

tbo
Member
Registered: 2015-04-20
Posts: 353

Re: Migrating to mormot 2

squirrel wrote:

What is the mormot 2 class for TSQLTableWritable called?

Maybe: unit mormot.orm.rest -> TOrmTableWritable

I did the conversion by taking the descriptive part of the name, in your case TSQLTableWritable => "TableWritable", and running a grep over all units. And as a second option, you can look for the compatibility definitions (example: type TSqlTable = TOrmTable). With this methods, you make fast progress.

With best regards
Thomas

Last edited by tbo (2022-08-11 20:16:49)

Offline

#4 2022-08-11 15:22:08

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: Migrating to mormot 2

SQL is usually changed to Orm
I use the total commander to make searches in the files of Mormot2 source if something can not be found in the second attempt

Offline

#5 2022-08-11 15:25:04

squirrel
Member
Registered: 2015-08-13
Posts: 155

Re: Migrating to mormot 2

Thanks TOrmTableWritable works perfectly.  I've been using windows grep for most of the day searching for the replacements.  Not sure how I missed this one.  Looks like my list is now starting to become useful.  I should be able to start migrating as soon as I find out about TDocVariantData.InitFromTypeInfo big_smile

Offline

#6 2022-08-11 15:34:59

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: Migrating to mormot 2

InitArray* probably?

Offline

#7 2022-08-11 15:47:13

squirrel
Member
Registered: 2015-08-13
Posts: 155

Re: Migrating to mormot 2

It doesnt look as if the InitArray* functions do the same

Offline

#8 2022-08-11 17:33:59

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: Migrating to mormot 2

There's no direct equivalent inside TDocVariantData, you can write your own InitFromTypeInfo using same code

Something like TDocVariantData.InitJson(SaveJson(AValue, ATypeInfo));

Offline

#9 2022-08-11 19:48:54

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

Re: Migrating to mormot 2

It does exist something to initialize a TDocVariant from a dynamic array.

    /// initialize a variant instance to store some dynamic array content
    procedure InitArrayFrom(var aItems; ArrayInfo: PRttiInfo;
      aOptions: TDocVariantOptions; ItemsCount: PInteger = nil); overload;

Offline

#10 2022-08-11 23:23:09

rdevine
Member
Registered: 2014-02-20
Posts: 52

Re: Migrating to mormot 2

If the new name for a class isn't obvious (e.g. remove the "SQL") I just search for a piece of text from the comments - the ones I've searched for so far have been unchanged.

Cheers, Bob

Offline

#11 2022-08-15 07:33:56

squirrel
Member
Registered: 2015-08-13
Posts: 155

Re: Migrating to mormot 2

Will the InitArrayFrom still provide the same structure / result when it is not an array?  I thought that would only apply to dynamic array types.

Last edited by squirrel (2022-08-15 07:34:24)

Offline

#12 2022-08-15 09:45:55

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

Re: Migrating to mormot 2

It is for dynamic array only, as you noticed.

Offline

Board footer

Powered by FluxBB