#151 mORMot 2 » Exception in 64Bit of Mormot 2 but not in 32Bit Version » 2023-01-13 17:49:50

itSDS
Replies: 8

Hi Arnaud since a few Days we get an Exception c0000005 in the 64Bit Assembly code of

TRWLock.ReadOnlyLock
in line
@spin:  mov     rax, qword ptr [rcx + TRWLock.Flags]

the 32Bit code runs without exception.

if you need more input let me know.

#152 mORMot 1 » How To Ignore SEC_E_CERT_EXPIRED Exception » 2023-01-05 13:48:08

itSDS
Replies: 1

Hi Arnaud,

is there an Option in mormot2 to ignore the Error, that an Certificate is expired as in normal http client ?

#153 mORMot 1 » enum without 0 as first cause c0000005 » 2022-12-20 08:13:07

itSDS
Replies: 1

I use a enum in my soa objects
and was wondering why the client does not send the enum for Set Value 0 (This is default and optimized out from mORMot - i found out)
then i changed enum to start with 1

  TMyEnum = (
    vv1 = 1, // added = 1
    vv2,
    vv3
  );

This causes an Exception in mormot.core.rtti SetEnumType (line 3537)

This is not critical to me, i changed first value back to 0 - But just to think about.

#154 Re: mORMot 1 » Error C0000005 with new _JS_RttiCustom » 2022-12-06 08:35:59

Ty Arnaud

it works without Exception now !

The Property raising Exception was an Enumeration like this:

TMyClass = class(TSynPersitent)
protected
...
fState : TMyState;
...
published
property ServerState : TMyState read fState;
...

Nothing speciell state had Value 3
This was the last value before Exception in JS_RttiColumn p^.name

#155 mORMot 1 » Error C0000005 with new _JS_RttiCustom » 2022-12-05 18:07:27

itSDS
Replies: 3

Hi AB
today i updated my mORMot and now i get an C0000005 in _JS_Enumeration  line   Ctxt.W.AddU(Data^); (Data = $9) (Not a valid Adress)
This is called from _JS_RttiCustom.

I Replaced the _JS_RttiCustom with the former one and no Exception is raised and JSON produced as expected.

You patched it in Commit: 7d39c5ff4f4faac2a104112514ff290394a08ef7

#156 Re: mORMot 1 » Difference m1 to m2 with JSON Quotes » 2022-12-05 11:11:22

Hi Thomas,

i tried it with your demo, but there is a internal difference to the mvc model i use.
The TDocVariantData in your case has the JSON as String and in mvc its a TDocVariantData which is converted to JSON without quotes - It's not the same...

As conclusion theres a difference passing JSON String to MVC from m1 to m2.

#157 Re: mORMot 1 » Difference m1 to m2 with JSON Quotes » 2022-12-04 15:32:16

Ty Thomas, (i didn't recognize this option to write expression Helper before)

But my concern for this ticket is the difference between m1 and m2.
and if this difference is wanted or not.

#158 Re: mORMot 1 » Difference m1 to m2 with JSON Quotes » 2022-12-03 09:33:26

Hm - May be you didnt understand what i mean...
How is it possible to add the missing 2 " to the m2 json ?
(i added ToJSON to my mustache line but same result)

@ab i do not understand what you mean with add /json to end of the page URI - What is "end of the page URI" ?

ty

this is generated in the html

    window.templates.vtSettings = '{myarray:["AB","CD","EF"]}';

#159 mORMot 1 » Difference m1 to m2 with JSON Quotes » 2022-12-02 09:29:55

itSDS
Replies: 7

Lets start with the bottom - to explain the problem
on our mvc page we use mustache and Javascript - With m1 it works and with m2 not.

we have a mustache partial with this code:

<script>
    window.templates = {};
    window.templates.vtSettings = '{{VTSettings}}';
</script>

VTSettings has this value : '{myarray:["AB","CD","EF"]}' and is a parameter of our MVC View

  IMyWebextensionsApplication = interface(IMVCApplication)
...
    procedure MyPage(var VTSettings : Variant);

later in our View we call Javascript to get the Array Elements from myarray:

  let VTSetting = replaceAll(window.templates.vtSettings, '{myarray:', '{"myarray":');   // <-- my Workaround :)
  let settings = JSON.parse(replaceAll(VTSetting, '&quot;', '"'));

at this place in m1 window.templates.vtSettings has the value

{&quot;myarray&quot;:[&quot;AB&quot;,&quot;CD&quot;,&quot;EF&quot;]}

and in m2

{myarray:[&quot;AB&quot;,&quot;CD&quot;,&quot;EF&quot;]}

JSON.Parse throws an Exception with the m2 Version. I have to add the quotes.

I debugged to find the reason in m2 and think there is a problem with mormot.core.variants.JsonToAnyVariant and the later ToJSON

#161 Re: mORMot 1 » Datetime should not be empty » 2022-11-29 20:02:12

@tbo

My Real Interface looks like this:

  TDObjArray = TArray<TDerivedObject >;

  IDomGverwaltung = interface(IInvokable) 
..
  function GetDerived(out ADerived : TDObjArray) : TresultRec;
..
  TInterfaceFactory.RegisterInterfaces([TypeInfo(IDomGverwaltung)]);

#162 Re: mORMot 1 » Datetime should not be empty » 2022-11-29 19:58:24

example for the TObject i use as parameter:

TBaseObject = class(TObject)
private
  fAnlagedatum : TDateTime;
..
published
  property Anlagedatum : TDateTime read fAnlagedatum;
end;

TDerivedObject = class(TBaseClass)
protected
  fAusgabedatum : TDateTime;
private
  procedure SetAusgabedatum(const AAusgabedatum : TDateTime);
published
  property Ausgabedatum : TDateTime read fAusgabedatum write SetAusgabedatum;

#163 Re: mORMot 1 » Datetime should not be empty » 2022-11-29 19:53:48

There is 1 difference: property ausgabedatum has a setter defined (setausgabedatum) then _JL_DateTime is not called but Ctxt.ParsePropComplex because Prop^.OffsetSet = -1 and ParsePropComplex calls my Patched TRttiProp.SetValue which tries to set my Ausgabedatum to "" -> resulting in an error.

and here is the json:

...
Vertrag:null,Standrohr:{ServerState:4,Anlagedatum:"2022-11-26T09:15:25",LetzteAenderung:"2022-11-26T09:15:25",GeloeschtAm:"",GeraetID:1916,Mandant:null,Geraetetyp:null,Kontrolle:null,Vertrag:null,Standrohr:null,Status:0,Lagerort:"",Seriennummer:"",Baujahr:0,Hersteller:"",Beschreibung:"",Identifikation:"",Notiz:"",Groesse:"",Bauform:"",Eichjahr:0,NextEichjahr:0,Zaehlerstand:0,Ausgabedatum:""},Status
...

#164 Re: mORMot 1 » Datetime should not be empty » 2022-11-29 16:51:22

I debugged the lines and the input Value is "" (Empty String) for the DateTime Property.
What i'm wondering about is that the parser calls different property parser for my DateTime property.
In case of my "ausgabedatum" Property it calls procedure TJsonParserContext.ParsePropComplex(Data: pointer);
And for one of my other DateTime Property "GeloeschtAm" it calls procedure _JL_DateTime(Data: PDateTime; var Ctxt: TJsonParserContext); the Value is in both Cases = ""

The Error displayed is:

EInterfaceFactory mit Meldung 'IDomV.GetG failed parsing AArray: TArray<DomVTypes.TGObject> from input JSON'. Prozess xyz.exe (1312) (Generated in mormot.core.interfaces line 2665)

#166 mORMot 1 » Datetime should not be empty » 2022-11-29 11:35:08

itSDS
Replies: 9

I Receive TObjects from my Server via SOA Interface.
The Object contains TDateTime Fields.
One of these date fields is null (0)

On the Client site these Objects are Create by RTTI calls in mORMot2.
I got an error if DateField = 0

As Patch i modified mormot.core.rtti.pas Line 3884f:

      f := _Iso8601ToDateTime(u);
//      if f = 0 then   // itSDS Datetime kann leer sein wenn es "Null" auf dem Server ist.
//        exit;
      SetFloatProp(Instance, f);
    end

Can you add this to the Repo - if my Patch is right ?

#167 mORMot 1 » Removing jpoNullDontReleaseObjectInstance from Interfacefactory » 2022-11-29 11:29:57

itSDS
Replies: 2

Hi AB to Remove jpoNullDontReleaseObjectInstance from my Interfacefactory i had to patch mormot.core.interfaces.pas
Is there another way ?

My Problem is that the autocreateted Objects in my Client also contain "empty" SubObjects although the received JSON contains "subobject:null"

#168 Re: mORMot 1 » Delphi FMX Android client? » 2022-10-05 08:59:15

Yes you need to have 11.x for ShortString Support

I never used CE Version but i think if you request a new one an remove old licence from you system it could work - or do they provide only 10.4 ?

#169 Re: mORMot 1 » Delphi FMX Android client? » 2022-10-03 22:20:59

ab wrote:

IIRC the shortstring type is not supported any more on iOS/Android.

And we use it in a lot of places.

I made a simple test for android an debugged it:

var
  LShortString : string[10];
begin
  LShortString := '123456';
  if Length(LShortString) = ord(LShortString[0]) then
    LShortString := 'correct';

This works on Android and Debugger shows array with dimension 11 where first byte is length. In this case the last 4 byte are randomly filled.
So it could work on android with 11.2

#170 Re: mORMot 1 » Delphi FMX Android client? » 2022-10-03 15:53:35

I'm also intersted in getting m2 Running under IOS/ANDROID. Tried to compile but there are many problems with the define in mormot.define.inc.

1. a extra section for iOS/ANDROID is needed.
2. All ASM Stuff does not compile under IOS/ANDROID So an Option NOASM or PUREPASCAL as in Delphi is needed.

I would like to help, should/can i make a branch in Repo ?

(If it works the SynCrossplatform Wrappers are not needed any more) (https://synopse.info/forum/viewtopic.php?id=5835)

I have the latest RS 11.2 from Embacadero installed and also a beta tester.

#171 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2022-08-27 07:06:20

Hi Arnaud, as you now completely switched to mORMot2 is there any chance that this bug will be fixed ?
This is the only reason for me to switch to mORMot1 sometimes.

tyvm

#172 Re: mORMot 1 » Logging 1 Line sllError takes 15 Seconds » 2022-03-17 09:47:50

ab wrote:

Perhaps the problem is that the .map file is recreated each time.

Is the .map file generated by Delphi for your project?
Is the .mab file properly generated by TDebugFile ?

Could you check if it is not TDebugFile.Create which is called by TDebugFile.Log on line 5670 of mormot.core.log which makes the delay.

Edit: Please try https://github.com/synopse/mORMot2/commit/99c7db03

Hi Arnaud, i only have the EXE on the Test Machine, no map / mab file.
After starting the App i can not find a mab/map file in the folder.

#173 Re: mORMot 1 » Logging 1 Line sllError takes 15 Seconds » 2022-03-17 09:19:22

Hi Arnaud,

i testet the latest commit.
Now OnlyApi is as fast as expected
OnlyManual does take the same time as before.

#174 Re: mORMot 1 » Logging 1 Line sllError takes 15 Seconds » 2022-03-15 19:21:41

As you can see Trace=0 works as expected. The Other have Delays.
The 15s Delay is at another Place in the Program where the Stack / Memory Usage is much bigger

#175 Re: mORMot 1 » Logging 1 Line sllError takes 15 Seconds » 2022-03-15 19:18:29

Here my Results, made 4 Tests

1. Default Settings

15.03.2022 20:04:57.688	Trace	1	 Program wurde gestartet
15.03.2022 20:04:57.688	Error	1	 Error1  
15.03.2022 20:04:59.608	Error	1	 Error2  
15.03.2022 20:05:00.976	Error	1	 Error3  
15.03.2022 20:05:03.656	Enter	1	 After Error3

2. OnlyApi

15.03.2022 20:05:45.944	Trace	1	 Program wurde gestartet
15.03.2022 20:05:45.944	Error	1	 Error1  
15.03.2022 20:05:47.784	Error	1	 Error2  
15.03.2022 20:05:48.992	Error	1	 Error3  
15.03.2022 20:05:51.240	Enter	1	 After Error3

3. OnlyManual

15.03.2022 20:06:18.304	Trace	1	 Program wurde gestartet
15.03.2022 20:06:18.304	Error	1	 Error1  
15.03.2022 20:06:19.784	Error	1	 Error2  
15.03.2022 20:06:21.112	Error	1	 Error3  
15.03.2022 20:06:23.288	Enter	1	 After Error3

4. StackTraceLevel=0

15.03.2022 20:09:37.144	Trace	1	 Program wurde gestartet
15.03.2022 20:09:37.144	Error	1	 Error1
15.03.2022 20:09:37.144	Error	1	 Error2
15.03.2022 20:09:37.144	Error	1	 Error3
15.03.2022 20:09:38.592	Enter	1	 After Error3

Example Code

TSynLog.Family.Level := LOG_VERBOSE;
  if AppHasParam('StackTraceLevel0') then
TSynLog.Family.StackTraceLevel := 0;
  if SameText(GetAppParamValue('StackTraceUse'), 'OnlyApi') then
TSynLog.Family.StackTraceUse := stOnlyApi;
  if SameText(GetAppParamValue('StackTraceUse'), 'OnlyManual') then
TSynLog.Family.StackTraceUse := stOnlyManual;
TSynLog.Family.HighResolutionTimeStamp := true;
TSynLog.Family.LocalTimeStamp := true;
TSynLog.Family.FileExistsAction := acAppend;
TSynLog.Family.PerThreadLog := ptIdentifiedInOnFile;
TSynLog.Family.RotateFileCount := 100;    // ca. 3 Monate
TSynLog.Family.RotateFileSizeKB := 5000 * 1024;
TSynLog.Family.RotateFileDailyAtHour := 23;
TSynLog.Family.IncludeComputerNameInFileName := true;
TSynLog.Family.DestinationPath := TPath.Combine(ExtractFilePath(Application.ExeName), 'Logs');
TDirectory.CreateDirectory(TSynLog.Family.DestinationPath);
TSynLog.Add.Log(sllTrace, 'Program wurde gestartet');
TSynLog.Add.Log(sllError, 'Error1');
TSynLog.Add.Log(sllError, 'Error2');
TSynLog.Add.Log(sllError, 'Error3');
---
After Error 3 - Later in code

#177 mORMot 1 » Logging 1 Line sllError takes 15 Seconds » 2022-03-15 10:37:17

itSDS
Replies: 8

Hi Arnaud,

Logging on a Standard Windows 11 Computer took a long time (much longer than on my develop maschine)
After looking in the Log i found the sllError Line takes 15 second.

The only Reason i found could be the StackTrace - Routines
I set StackTraceLevel to 0 an the delay disappeared (It disabled the StackTrace Option)
as i do not need the StackTrace at this log its not important for me.

But do you have an Idea what i have to do to avoid the delay on active StackTrace ? Is there a Windows - Option ? Does the Windows User afford som special rights ?

#178 Re: mORMot 1 » C0000005 in mormot.soa.core 64Bit » 2022-02-10 11:47:54

I wrote a derived Class from TInterfaceFactory which does not evaluate the Methods...

#180 mORMot 1 » C0000005 in mormot.soa.core 64Bit » 2022-02-10 11:31:29

itSDS
Replies: 4

Hi Arnaud,

today i got an exception in this method:
My Bugfix is here: can you pls add it to repo

function TServiceContainer.AddServiceInternal(aService: TServiceFactory): PtrInt;
var
  MethodIndex: integer;

  procedure AddOne(const aInterfaceDotMethodName: RawUtf8);
  var
    p: PServiceContainerInterfaceMethod;
  begin
    p := fInterfaceMethods.AddUniqueName(aInterfaceDotMethodName);
    p^.InterfaceService := aService;
    p^.InterfaceMethodIndex := MethodIndex;
    inc(MethodIndex);
  end;

var
  aUri: RawUtf8;
  internal: TServiceInternalMethod;
  m: PtrInt;
begin
  if (self = nil) or
     (aService = nil) then
    raise EServiceException.CreateUtf8(
      '%.AddServiceInternal(%)', [self, aService]);
  // add TServiceFactory to the internal list
  if ExpectMangledUri then
    aUri := aService.fInterfaceMangledUri
  else
    aUri := aService.fInterfaceUri;
  PServiceContainerInterface(fInterfaces.AddUniqueName(aUri, @result))^.
    Service := aService;
  // add associated methods - first SERVICE_PSEUDO_METHOD[], then from interface
  aUri := aUri + '.';
  MethodIndex := 0;
  for internal := Low(internal) to High(internal) do
    AddOne(aUri + SERVICE_PSEUDO_METHOD[internal]);
// BUGFIX here

  for m := 0 to (integer(aService.fInterface.MethodsCount)-1) do    /// <<<---- Wrong Subtraction MethodsCount is Cardinal and mc-1 is also cardinal.
    AddOne(aUri + aService.fInterface.Methods[m].Uri);


end;

#181 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2022-01-27 14:50:13

Today I had another problem in the Wrapper Generator.
The generated ContractID is different between mORMot2 and mORMot.
However, after I inserted the one generated by mORMot, the data transfer still works.

#182 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2022-01-25 14:01:07

Hi Arnaud,

i like to move completely to mORMot2. But this feature is a show stopper atm.
I tested and debugged the Problem now for hours but can not solve it.
I just have some new hints and things i found out.

I use the same Sample as above. Slightly enhanced. if you like i can send you the code or show the Problem by Teamviewer.
i Compared the mORMot and mORMot2 by debugging TWrapperContent. And added some TSynLog Stuff to dig in the deep.

The Following Errors are in mORMot2:
1. Nested Records are expanded the reason is in the used new rtti props in ContextOneProperty function

for mORMot Version prop.PropertyType is ptCustom and for mORMot2 prop.Value.Parser is ptRecord
(generally it is a ptRecord but i do not know where mORMot generates the ptCustom where mORMot2 has a ptRecord.)
this adds additional nestedRecord in the structure. which is wrong.

2. Second BUG is a DynArray of (Record or simple Type e.g. String)
in mORMot the Code is correct
in M2 You internally map ptDynArray to Blob which results in wrong code. The Wrong Conversion occurs for example in ContextFromRTTI in

typ := TYPES_ORM[GetOrmFieldType(rtti.Info)];

Hopefully you have an idea to fix the Wrapper Generator with this info

#183 mORMot 1 » External DB function Problem (mormot2) » 2021-12-01 13:27:01

itSDS
Replies: 1

Hi Arnaud

atm im struggling with an external Oracle DB - I used both ConnectionProperties:  TSqlDBOracleConnectionProperties and TSQLDBUniDACConnectionProperties (for Oracle)

i use code like this:

var LVariant := RestModel.RetrieveDocVariantArray(TSQLEOR_SomeRecord,'', 
'trunc(DateTimeField) = trunc(sysdate)' ,  // <-- SQLite Error Oracle SQL Function sysdate unknown
 [] , 
'ID, DateTimeField, Field1, Field2, Field3,')

Example for other Oracle functions not working:

to_char( datetimefield, 'YYYY-MM-DD' ) = '2021-12-01'  // SQLite Error: to_char unkown
trunc( datetimefield ) = to_date('2021-12-01', 'YYYY-MM-DD')");  // SQLite Error: to_date unknown

trunc is also unkown smile

Is there a possibilty to let SQLite know the functions or to get the Query run
Why does SQLite have to know the functions ?

Best Regards

#184 Re: mORMot 1 » BUGFix for mORMot.pas » 2021-10-06 15:39:48

thank you - yes i used a piece of code with mORMot2 and then with mORMot and under mORMot my Objekt was freed in Support...

#185 mORMot 1 » BUGFix for mORMot.pas » 2021-10-06 11:28:59

itSDS
Replies: 3

Hi Arnaud. i tried to upload this patch to github. But my credentials are rejected

diff --git a/SQLite3/mORMot.pas b/SQLite3/mORMot.pas
index 5b692f78..30d00b67 100644
--- a/SQLite3/mORMot.pas
+++ b/SQLite3/mORMot.pas
@@ -58447,10 +58447,11 @@ begin
   else
     result := fImplementationClass.Create;
   end;
+  inc(TInterfacedObjectHooked(result).FRefCount); // >0 to call Support() in event
   if Assigned(TSQLRestServer(Rest).OnServiceCreateInstance) then
     TSQLRestServer(Rest).OnServiceCreateInstance(self,result);
-  if AndIncreaseRefCount then
-    IInterface(result)._AddRef; // allow passing self to sub-methods
+  if not AndIncreaseRefCount then
+    dec(TInterfacedObjectHooked(result).FRefCount);
 end;
 
 procedure TServiceFactoryServer.OnLogRestExecuteMethod(Sender: TServiceMethodExecute;

#186 mORMot 1 » mORMOT 2 Exceptions in LogTrailer on sllError » 2021-08-31 10:21:50

itSDS
Replies: 1

Hi Arnaud

i found the following "bug" between DEBUG and RELEASE Version in mORMot2:

I get lot's of Exception (> 200) at this line of code:

mORMot.rest.client: 2460 (InternalLog('% % returned % (%) with message  %',  [method, url, Call.OutStatus, StatusMsg, fLastErrorMessage], sllError);)

only in RELEASE Mode - not in DEBUG Mode !

so it was a bit tricky to get the cause for the Exceptions.

The Source for the Exceptions is in mormot.core.log: AddStackTrace in LogTrailer (sllError is in fLevelStackTrace) around line 5416
your are ignoring the Exceptions but they are displayed in the LogFile - and on console Screen.

As WorkAround i added this piece of code to my "Log Initialisation Code"

{$if defined(RELEASE)}
    TSynLog.Family.LevelStackTrace := TSynLog.Family.LevelStackTrace - [sllError];
{$endif}

There are other Log Levels in LevelStackTrace wich may rise the same Exceptions
May be you have an Idea what's the Problem.
in mORMot the Problem does not exists - but i saw that you did a big rework in TSynLog

#188 Re: mORMot 1 » mORMot2 Oracle - Patch » 2021-07-13 17:56:03

k next time i try the correct way

#189 mORMot 1 » mORMot2 Oracle - Patch » 2021-07-13 17:37:40

itSDS
Replies: 2

Hi AB i use mORMot2 with Oracle and got error in GetFields.
Hier is my Patch for this

procedure TSqlDBUniDACConnectionProperties.GetFields(const aTableName: RawUtf8;
  out Fields: TSqlDBColumnDefineDynArray);
var
  meta: TDAMetaData;
  n: integer;
  F: TSqlDBColumnDefine;
  FA: TDynArray;
  hasSubType: boolean;
  Owner, Table: RawUtf8;
begin
  meta := (MainConnection as TSqlDBUniDACConnection).fDatabase.CreateMetaData;
  try
    FA.Init(TypeInfo(TSqlDBColumnDefineDynArray), Fields, @n);
    FA.Compare := SortDynArrayAnsiStringI; // FA.Find() case insensitive
    FillCharFast(F, sizeof(F), 0);
    meta.MetaDataKind := 'Columns';
    Split(aTableName, '.', Owner, Table);
    if Table = '' then
    begin
      Table := Owner;
      Owner := '';
    end;

// PATCH
    if (Owner = '') and
       (fDBMS <> dOracle) then
      Owner := MainConnection.Properties.DatabaseName; // itSDS
// PATCH

    if Owner <> '' then
      meta.Restrictions.Values['TABLE_SCHEMA'] := Utf8ToString(UpperCase(Owner))
    else
      meta.Restrictions.Values['SCOPE'] := 'LOCAL';
    meta.Restrictions.Values['TABLE_NAME'] := Utf8ToString(UpperCase(Table));
    meta.Open;
    hasSubType := meta.FindField('DATA_SUBTYPE') <> nil;
    while not meta.Eof do
    begin
      F.ColumnName := StringToUtf8(meta.FieldByName('COLUMN_NAME').AsString);
      F.ColumnTypeNative := StringToUtf8(meta.FieldByName('DATA_TYPE').AsString);
      if hasSubType then
        F.ColumnTypeNative := F.ColumnTypeNative +
          StringToUtf8(meta.FieldByName('DATA_SUBTYPE').AsString);
      F.ColumnLength := meta.FieldByName('DATA_LENGTH').AsInteger;
      F.ColumnScale := meta.FieldByName('DATA_SCALE').AsInteger;
      F.ColumnPrecision := meta.FieldByName('DATA_PRECISION').AsInteger;
      F.ColumnType := ColumnTypeNativeToDB(F.ColumnTypeNative, F.ColumnScale);
      if F.ColumnType = ftUnknown then
      begin
        // UniDAC metadata failed -> use SQL
        Fields := nil;
        inherited GetFields(aTableName, Fields);
        exit;
      end;
      FA.Add(F);
      meta.Next;
    end;
    Setlength(Fields, n);
    GetIndexesAndSetFieldsColumnIndexed(aTableName, Fields);
  finally
    meta.Free;
  end;
end;

#190 Re: mORMot 1 » Problem compiling mormot2 (E2251) » 2021-07-13 17:31:45

as Solution you should not overload the function and instead rename the second Function e.g to Utf8ToStringP

/// convert any UTF-8 encoded String into a generic VCL Text
// - it's prefered to use TLanguageFile.Utf8ToString() in mORMoti18n,
// which will handle full i18n of your application
// - it will work as is with Delphi 2009+ (direct unicode conversion)
// - under older version of Delphi (no unicode), it will use the
// current RTL codepage, as with WideString conversion (but without slow
// WideString usage)
function Utf8ToString(const Text: RawUtf8): string; // itSDS overload;
  {$ifdef HASINLINE}inline;{$endif}

/// convert any UTF-8 encoded String into a generic VCL Text
procedure Utf8ToStringP(const Text: RawUtf8; var result: string); // overload;
  {$ifdef HASINLINE}inline;{$endif}

what do you think

#191 Re: mORMot 1 » Problem compiling mormot2 (E2251) » 2021-07-13 17:26:25

i testet something:

there was a former Version of mormot.core.unicode.pas without generating the error:


/// convert any UTF-8 encoded String into a generic VCL Text
// - it's prefered to use TLanguageFile.Utf8ToString() in mORMoti18n,
// which will handle full i18n of your application
// - it will work as is with Delphi 2009+ (direct unicode conversion)
// - under older version of Delphi (no unicode), it will use the
// current RTL codepage, as with WideString conversion (but without slow
// WideString usage)
function Utf8ToString(const Text: RawUtf8): string;
  {$ifdef HASINLINE}inline;{$endif}

/// convert any UTF-8 encoded buffer into a generic VCL Text

#192 mORMot 1 » Problem compiling mormot2 (E2251) » 2021-07-13 17:25:25

itSDS
Replies: 4

There is a problem compiling 32Bit mORMot2 with Rad Studio 10.4.2

Errror: [dcc32 Fehler] xxxx.pas(196): E2251 Doppeldeutiger überladener Aufruf von 'UTF8ToString'
  System.pas(40375): Verwandte Methode: function UTF8ToString(const RawByteString): string;
  mormot.core.unicode.pas(3896): Verwandte Methode: function Utf8ToString(const UTF8String): string;

actual i put mormot.core.unicode.UTF8ToString( in my code but i have a lot of code with UTF8ToString
Is there a easy solution ?

System.pas is included in any unit or ?

#193 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-06-14 13:47:07

hi Arnaud,

i had a look in the Source code and compared the Units "mORMotWrappers" and "mORMot.soa.codegen"

the TWrapperContext.ContextOneProperty seems to produce different structure.
But i have no idea how to fix it and where exactly the Problem is.
But in mORMot2 the nestedRecord Property is filled and in mORMot not for the same "TResultRec"

mORMot2:

{
	"typeWrapper": "wRecord",
	"typeSource": "TresultRec",
	"typeDelphi": "TresultRec",
	"typePascal": "TresultRec",
	"typeCS": "TresultRec",
	"typeJava": "TresultRec",
	"typeTS": "TresultRec",
	"typeSwagger": "TresultRec",
	"isRecord": true,
	"toVariant": "TresultRec2Variant",
	"fromVariant": "Variant2TresultRec",
	"propName": "resultRec",
	"fullPropName": "resultRec",
	"isSimple": null,
	"nestedRecord": {
		"nestedRecord": null,
		"fields": [
			{
				"typeWrapper": "wRawUtf8",
				"typeSource": "UTF8String",
				"typeDelphi": "RawUtf8",
				"typePascal": "String",
				"typeCS": "string",
				"typeJava": "String",
				"typeTS": "string",
				"typeSwagger": "{\"type\":\"string\"}",
				"propName": "erfolgJN",
				"fullPropName": "resultRec.erfolgJN",
				"nestedIdentation": "  ",
				"isSimple": true
			},
			{
				"typeWrapper": "wRawUtf8",
				"typeSource": "UTF8String",
				"typeDelphi": "RawUtf8",
				"typePascal": "String",
				"typeCS": "string",
				"typeJava": "String",
				"typeTS": "string",
				"typeSwagger": "{\"type\":\"string\"}",
				"propName": "fehlertext",
				"fullPropName": "resultRec.fehlertext",
				"nestedIdentation": "  ",
				"isSimple": true
			},
			{
				"typeWrapper": "wRawUtf8",
				"typeSource": "UTF8String",
				"typeDelphi": "RawUtf8",
				"typePascal": "String",
				"typeCS": "string",
				"typeJava": "String",
				"typeTS": "string",
				"typeSwagger": "{\"type\":\"string\"}",
				"propName": "hinweistext",
				"fullPropName": "resultRec.hinweistext",
				"nestedIdentation": "  ",
				"isSimple": true
			},
			{
				"typeWrapper": "wInteger",
				"typeSource": "Integer",
				"typeDelphi": "Integer",
				"typePascal": "Integer",
				"typeCS": "integer",
				"typeJava": "int",
				"typeTS": "number",
				"typeSwagger": "{\"type\":\"integer\"}",
				"propName": "resultcount",
				"fullPropName": "resultRec.resultcount",
				"nestedIdentation": "  ",
				"isSimple": true
			}
		]
	}
}

mORMot:

{
	"typeWrapper": "wRecord",
	"typeSource": "TresultRec",
	"typeDelphi": "TresultRec",
	"typePascal": "TresultRec",
	"typeCS": "TresultRec",
	"typeJava": "TresultRec",
	"typeTS": "TresultRec",
	"typeSwagger": "TresultRec",
	"isRecord": true,
	"toVariant": "TresultRec2Variant",
	"fromVariant": "Variant2TresultRec",
	"propName": "resultRec",
	"fullPropName": "resultRec",
	"isSimple": null
}

My be you have an idea how to fix it ?! It would be a great help. Ty

#194 Re: mORMot 1 » Problem: Cookie Handling in MVC Server is Case sensitive » 2021-05-05 11:24:34

Yes i like it smile

I applied the same Patch to mORMot V2. (mormot.rest.http.server.pas - Line 1010)

#195 Re: mORMot 1 » Problem: Cookie Handling in MVC Server is Case sensitive » 2021-05-05 08:47:54

Hi Arnaud, late feedback.
I testet it now and there is a little change i made to the Option:

In Line 927 of MORMotHttpServer i added a '/' slash in front of the serv.model.root, because else there's a kind of recursion generting wrong url (It repeats the serv.Model.Root serveral Times)

    if fRedirectServerRootUriForExactCase and (match=rmMatchWithCaseChange) then begin
      // force redirection to exact Server.Model.Root case sensitivity
      call.OutStatus := HTTP_TEMPORARYREDIRECT;
      call.OutHead := 'Location: /'+serv.Model.Root+                                /// <<<---- SLASH ADDED !
        copy(call.Url,length(serv.Model.Root)+1,maxInt);
    end else begin

#196 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-04-10 11:05:06

@flydev the Problem is here with nestet Records and Array of...

Here is a link to download my sample

for mORMot2 define USE_MORMOTV2 in the options

https://cloud.diestelmann-it-gmbh.de/s/iqQ9zCbRwKMmW8M

#197 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-04-09 09:47:35

i didn't dig in the deep - yet. No proposals atm.

#198 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-04-08 14:51:24

If i generate the Wrapper with mORMot and the SOA Service with mORMot2 it works smile

#199 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-04-08 14:37:03

Same Code with mORMot

unit mORMotClient;

{
  WARNING:
    This unit has been generated by a mORMot 1.18.6262 server.
    Any manual modification of this file may be lost after regeneration.

  Synopse mORMot framework. Copyright (C) 2021 Arnaud Bouchez
    Synopse Informatique - http://synopse.info

  This unit is released under a MPL/GPL/LGPL tri-license,
  and therefore may be freely included in any application.

  This unit would work on Delphi 6 and later, under all supported platforms
  (including MacOSX, and NextGen iPhone/iPad), and the Free Pascal Compiler.
}

interface

uses
  SynCrossPlatformJSON,
  SynCrossPlatformSpecific,
  SynCrossPlatformREST;
  

type // define some enumeration types, used below
  TPeopleSexe = (sFemale, sMale);
  TRecordEnum = (reOne, reTwo, reLast);

type // define some record types, used as properties below
  TresultRec = record
    erfolgJN: String;
    fehlertext: String;
    hinweistext: String;
  end;

  TTestCustomJSONArraySimpleArray = record
    F: String;
    F1: TresultRec;
    G: array of String;
    H: record
      H1: Integer;
      H2: String;
      H3: record
        H3a: Boolean;
        H3b: TSQLRawBlob;
      end;
    end;
    I: TDateTime;
    J: array of record
      J1: Byte;
      J2: TGUID;
      J3: TRecordEnum;
    end;
  end;

  TResultRecord = record
    resultRec: record
      erfolgJN: String;
      fehlertext: String;
      hinweistext: String;
    end;
    FResult1: String;
    FResult2: String;
    FResult3: String;
    FResult4: String;
  end;

  TSimpleRecord = record
    A: Integer;
    B: Integer;
    C: String;
  end;

#200 Re: mORMot 1 » mORMot2 Wrapper generation broken » 2021-04-08 14:34:57

Example from mORMot2

unit mORMotClient;

{
  WARNING:
    This unit has been generated by a mORMot 2.0.1 server.
    Any manual modification of this file may be lost after regeneration.

  Synopse mORMot framework. Copyright (C) 2021 Arnaud Bouchez
    Synopse Informatique - http://synopse.info

  This unit is released under a MPL/GPL/LGPL tri-license,
  and therefore may be freely included in any application.

  This unit would work on Delphi 6 and later, under all supported platforms
  (including MacOSX, and NextGen iPhone/iPad), and the Free Pascal Compiler.
}

interface

uses
  SynCrossPlatformJSON,
  SynCrossPlatformSpecific,
  SynCrossPlatformREST;
  

type // define some enumeration types, used below
  TPeopleSexe = (sFemale, sMale);

type // define some record types, used as properties below
  TresultRec = record
      erfolgJN: String;
      fehlertext: String;
      hinweistext: String;
  end;

  00e21f50 = record
        H3a: Boolean;
        H3b: RawBlob;
  end;

  00e21ea0 = record
      H1: Integer;
      H2: String;
      H3: 00e21f50;record
        H3a: Boolean;
        H3b: RawBlob;
      end;
  end;

  TTestCustomJSONArraySimpleArray = record
    F: String;
    F1: TresultRec;record
      erfolgJN: String;
      fehlertext: String;
      hinweistext: String;
    end;
    G: RawBlob;
    H: 00e21ea0;record
      H1: Integer;
      H2: String;
      H3: 00e21f50;record
        H3a: Boolean;
        H3b: RawBlob;
      end;
    end;
    I: TDateTime;
    J: RawBlob;
  end;

  00e213a0 = record
      erfolgJN: String;
      fehlertext: String;
      hinweistext: String;
  end;

Board footer

Powered by FluxBB