#1 2014-09-10 12:13:48

Almadrav
Member
Registered: 2014-09-10
Posts: 3

Adding in Batch Mode in Crossplattform Mobile Client

Hi,

I am adding records in batch mode from a FireMonkey client (Windows and Android) but when I send many records the server receives the data incorrectly.

when I Inspect "Ctxt.Call.InBody" in server procedure TSQLRestServer.Batch

procedure TSQLRestServer.Batch(Ctxt: TSQLRestServerURIContext);
var Results: TIntegerDynArray;
    i: integer;
begin 
  if not (Ctxt.Method in [mPUT,mPOST]) then begin
    Ctxt.Error('PUT/POST only');
    exit;
  end;
  try
    EngineBatchSend(Ctxt.Table,Ctxt.Call.InBody,Results);
...

the content from 4098 character is junk.
For example:

Ctxt.Call.InBody:
     ..,"PromotionCode":"","ReturnReason"'#0#0#0#0'K'#0#0#4#1#0#0#0'¯c*E^ñ˜'#0#0...
                                         ^Position 4098

If I send a set of records that do not exceed this size (4098) then the server receives the data correctly.

Any clue what could be doing wrong?

Thank you.

Offline

#2 2014-09-10 12:20:39

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

Re: Adding in Batch Mode in Crossplattform Mobile Client

Three small questions:
1. Is the content correct on client side?
2. Is it working under Windows, or only under Android?
3. Is there any known limitation (feature?) of Indy?

Could you try to force the use of our SynCrtSock.pas unit instead of Indy, under Windows?
Try to change in SynCrossPlatformSpecific.pas:

    {$ifdef UNICODE}    // for debugging Indy within the IDE
      {$define USESYNCRT} // WAS : {$define USEINDY}   <----------
    {$else}
      {$define USESYNCRT}
    {$endif}

This may help to find out, under Windows only, if the issue is in our SynCrossPlatform*.pas unit, or if we have to circumvent an Indy restriction.

Offline

#3 2014-09-10 15:25:45

Almadrav
Member
Registered: 2014-09-10
Posts: 3

Re: Adding in Batch Mode in Crossplattform Mobile Client

Hello ab,

I'm so sorry but when I Inspected the "Ctxt.Call.InBody" in server procedure TSQLRestServer.Batch I had used the Delphi "Evaluate/Modify" window (The Server is in Delphi 7)
and the trash after Position 4098 is a problem of that window.  Because If Evaluate the expressions:

Length(Ctxt.Call.InBody)
the Result is 8555 (is ok)

and

Copy(Ctxt.Call.InBody, Length(Ctxt.Call.InBody) - 100, 8000) 
the Result is ok:
 'ipmentDate":"","UnitWeight":0,"UnitVolume":0,"Batch":"","BatchExpireDate":"","FromLocationCode":""}]}'

but if I evaluate the expression
Ctxt.Call.InBody 
the result after position 4098 is trash

Sorry about that!

But the problem of adding a lot of records in batch mode persist. In server I have this error:

ESQLite3Exception ("Error SQLITE_ERROR (1) - \"near \",\": syntax error\"") at 00476ED2  stack trace API 0043C18C 004047F0
20140910 17044501 EXC           EORMException ("TSQLRestServerDB.InternalBatchStop: BatchMethod=0") at 0047A1B7  stack trace API 0043C18C 004047F0

Let me more time to find where the problem is.

Thank you for your time.

Offline

#4 2014-09-10 19:07:37

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

Re: Adding in Batch Mode in Crossplattform Mobile Client

Could you please use the debugger on server side, and find out what is the SQL statement which fails to execute?

Are you sure you are using the latest .obj files for sqlite3?
See http://synopse.info/files/sqlite3obj.7z

Offline

Board footer

Powered by FluxBB