#1 2014-01-03 12:18:59

martin.suer
Member
Registered: 2013-12-15
Posts: 76

TSQLRecord String Properties

Hi,

from the Docs I can see that RawUTF8 (Unicode Strings encoded in AnsiString) is the preferred Type for String properties in TSQLRecord Descendants. As a Delphi XE5 user, are  there any downsides if I just use String as the Type for String properties when I don't need to be compatible with older versions of Delphi?

Thanks
Martin

Offline

#2 2014-01-03 12:31:30

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

Re: TSQLRecord String Properties

You can use UnicodeString = String with Delphi XE5, but it will add some hidden UTF-16 to/from UTF-8 conversion, since the mORMot core is UTF-8 from the ground up.
Our code is very optimized, so I suspect you won't notice only a slight delay due to this conversion.

So, in short, if you are using an Unicode version of Delphi, you can safely use the String type.
You will probably have a lot of warnings in your IDE complaining about "implicit conversion of string type", which may be inconvenient for a big project.
You will also lack of the availability of a lot of RawUTF8 optimized functions and methods in SynCommons.pas and mORMot.pas - which are preferred in comparison to System.SysUtils units or such (especially under Win64).
Note also that using a dedicated string type for the mORMot core will enforce that you won't create coupling between your program core and your User Interface, for instance.

This is what we mean by saying that "RawUTF8 is preferred".
smile

Offline

#3 2014-01-03 13:38:34

martin.suer
Member
Registered: 2013-12-15
Posts: 76

Re: TSQLRecord String Properties

Thank you, great. That gives me enough reason to use RawUTF8 wink

Offline

Board footer

Powered by FluxBB