#2 mORMot 1 » TDocVariantData.ToJSON loosing values » 2018-12-14 07:49:46

arvin
Replies: 2

docVar: TDocVariantData
...

--debug docVar
--[Evaluate/Modify]
--Result:
(271, [dvoIsObject], ('type_temp', 'sxhzjbxx', '', '', '', '', '', '', '', '', '', '', '', '', '', ''), (2101, '[{"DE02_01_039_001":"DE02_01_039_001","DE02_01_040_00":"DE02_01_040_00","DE02_01_026_01":123,"DE02_01_032_02":"DE02_01_032_02","DE02_01_031_01":"DE02_01_031_01","DE02_01_030_01":"DE02_01_030_01","DE02_01_005_01_01":"DE02_01_005_01_01","DE01_00_021_00":"DE01_00_021_00","DE01_00_022_01":"DE01_00_022_01","DE01_00_008_01":"DE01_00_008_01","DE08_10_908_00":"DE08_10_908_00","DE01_00_010_00":"DE01_00_010_00","DE01_00_014_01":"DE01_00_014_01","DE02_01_060_00":"DE02_01_060_00","DE02_01_052_01":"DE02_01_052_01","DE08_10_007_01":"DE08_10_007_01","DE02_01_010_14":"DE02_01_010_14","DE02_01_024_01":"DE02_01_024_01","DE02_01_009_01_11":"DE02_01_009_01_11","DE02_01_009_02_11":"DE02_01_009_02_11","DE02_01_009_03_11":"DE02_01_009_03_11","DE02_01_009_04_11":"DE02_01_009_04_11","DE02_01_009_05_11":"DE02_01_009_05_11","DE02_01_009_06_11":"DE02_01_009_06_11","DE02_01_047_01":1,"DE02_01_010_01":"DE02_01_010_01","DE02_01_039_011":"DE02_01_039_011","DE02_01_010_02":"DE02_01_010_02","DE02_01_044_01":"DE02_01_044_01","DE08_10_025_01":"DE08_10_025_01","DE08_10_052_01":"DE08_10_052_01","CT08_10_052_01":"CT08_10_052_01"}]', Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned, Unassigned), 1)

...
Memo1.Lines.Text := docVar.ToJSON;   //{"type_temp":2101}  ???

why loosing 'sxhzjbxx'   ?

#3 mORMot 1 » Database query error. » 2018-11-30 02:52:15

arvin
Replies: 1

Hi ab,
I'm trying to use mORMot with SQL Server 2008,   get an error message after query the database multiple times.

code:

  ...
  fProps := TODBCConnectionProperties.Create('','DSN=LocalhostDB;UID=sa;PWD=123;APP=Enterprise;WSID=ARVIN-F;DATABASE=HIS;','',''); // The database link is correct
  Conn := fProps.ThreadSafeConnection;
  if not Conn.Connected then
    Conn.Connect;
  fServer := THttpApiServer.Create(false);
  fServer.AddUrl('root', '888', false, '+', true);
  fServer.RegisterCompress(CompressDeflate);
  fServer.OnRequest := Process;
  fServer.Clone(31);
  ...

function TJSONServer.Process(Ctxt: THttpServerRequest): cardinal;
begin
  try
    if length(Ctxt.InContent)<5 then
      raise ESynException.CreateUTF8('Invalid request % %',[Ctxt.Method,Ctxt.URL]);
    Ctxt.OutContentType := JSON_CONTENT_TYPE;
    Ctxt.OutContent := fProps.Execute(Ctxt.InContent,[]).FetchAllAsJSON(true);
    result := 200;
  except
    on E: Exception do begin
      Ctxt.OutContentType := TEXT_CONTENT_TYPE;
      Ctxt.OutContent := StringToUTF8(E.ClassName+': '+E.Message)+#13#10+Ctxt.InContent;
      result := 504;
    end;
  end;
end;

The Errormessage is this:   sad
EAccessViolation: Access violation at address 0045E5A1 in module 'JsonSQLServer.exe'. Read of address 02310000

mORMot code:

function UpperCopy255BufSSE42(dest: PAnsiChar; source: PUTF8Char; sourceLen: PtrInt): PAnsiChar;
asm // eax=dest edx=source ecx=sourceLen
       test    ecx,ecx
       jz      @z
       movdqu  xmm1, dqword ptr [@az]
       movdqu  xmm3, dqword ptr [@bits]
       cmp     ecx, 16
       ja      @big
       // optimize the common case of sourceLen<=16
       movdqu  xmm2, [edx]      [b]<<<<< an exception occurs[/b]
       
....

Board footer

Powered by FluxBB