#1 Re: mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2023-01-18 20:59:07

ab wrote:

So consider defining NOSQLITE3STATIC conditional for your project on Win64, and use the external .dll.

I can see the sqlite3-64.dll only for win64. Is there a sqlite3.dll for win32 as well?

#2 Re: mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2022-12-17 16:58:40

What about the JSON/RPC calls?
Is JSON structure the same?
I'm asking because I have created a java mORMot client, calling my Delphi mORMot server.

#3 Re: mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2022-12-15 13:44:03

Thanks Arnaud,
will consider using external .dll initially.

Will source code require a lot of change when switching to mORMot 2?

#4 Re: mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2022-12-14 21:38:34

I am using Delphi 10.1 Update 2, console app, mORMot 1, latest commit (aad97c6d418ee57af92acd500ead298832ddfc68)

#5 Re: mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2022-12-14 18:58:09

OK, but it doesn't solve the problem, see code below

procedure Test;
var
  Prop1: TSQLDBSQLite3ConnectionProperties;
  Stmt1: ISQLDBRows;
begin
    Prop1 := TSQLDBSQLite3ConnectionProperties.Create('z:\data.db3', '', '', '');
    try
      Stmt1 := Prop1.Execute('select * from Data order by _$Index$_, _$Index2$_', []);
//      Stmt1 := Prop1.Execute('select * from Data', []); <-- this one works ok
//      Stmt1 := Prop1.ExecuteInlined('select * from Data order by _$Index$_, _$Index2$_', true); <-- fails as well
      Stmt1.Step;
      Stmt1.ReleaseRows;
      Stmt1 := nil;
    finally
      Prop1.Free;
    end;
end;

#6 mORMot 1 » SQLite3 64bit no such savepoint error when using ORDER BY » 2022-12-13 22:33:14

dexter
Replies: 16

Hi,

Below small code raises following error when compiled in 64bit Delphi 10.1:

ESQLite3Exception {"ErrorCode":1,"SQLite3ErrorCode":"secERROR","Message":"Error SQLITE_ERROR (1) [Step] using 3.40.0 - no such savepoint: , extended_errcode=1"} [] at 01635014 SynSQLite3.sqlite3_check (5412)

When compiled in 32bit platform - it works as expected.
When ORDER BY clause is removed - it works as expected in 64bit as well.

The small db3 file is saved here: https://drive.google.com/file/d/1UfJ_HV … sp=sharing

procedure Test;
var
  Con1: TSQLDBSQLite3Connection;
  Prop1: TSQLDBSQLite3ConnectionProperties;
  Stmt1: TSQLDBStatement;
begin
    Prop1 := TSQLDBSQLite3ConnectionProperties.Create('data.db3', '', '', '');
    Con1 := TSQLDBSQLite3Connection.Create(Prop1);
    try
      Con1.Connect;
      Stmt1 := Con1.NewStatement;
      Stmt1.Execute('select * from Data order by _$Index$_, _$Index2$_', true);
      Stmt1.Step();
    finally
      Stmt1.Free;
      Con1.Free;
      Prop1.Free;
    end;
end;

#7 mORMot 1 » Download big files from server » 2021-09-18 22:05:55

dexter
Replies: 6

Hi,

I'm generating big files on server side and need to download them to client.

On server side:

Ctxt.ReturnFile(FileName, false, 'application/octet-stream');

On client side:

    if FClient.CallBackGet('GetFile', ['FileName', aFileName], FileContent) <> HTTP_SUCCESS then
      raise Exception.CreateFmt('Cannot get result file from server: %s', [FileContent]);

  FileFromString(FileContent, 'somefile.big', true);

It works ok, but my concern is the memory consumption when files are 1GB+ in size.
How can I save the downloaded content to a stream "on the fly" and not having the file's content all at once in the RAM (in FileContent variable)?

#9 Re: mORMot 1 » Create function in Oracle » 2020-08-11 09:16:30

mpv wrote:

I fix an infinity loop in ; removal implementation for statements what ends with space chars, like:   '....END;'#10
Also simplify logic a bit - please, merge #341

I think because of this change now it fails again.
I mean I have updated to latest code and the trick with ';;' does not work anymore.
I have reverted back to commit 82b4176 and works again.

#10 Re: mORMot 1 » Continue log until rotation on app restart » 2020-08-10 15:21:22

That was quick!

Thanks Arnaud, looks ok for me.

#11 mORMot 1 » Continue log until rotation on app restart » 2020-08-10 14:57:43

dexter
Replies: 2

Hi,

I have set the following rotation params:

    RotateFileDailyAtHour := 0;
    RotateFileCount := 7;

On app restart the "main" log is rewritten from scratch, so I loose my last logs.
Would be nice on application restart to continue writing to current log file (if it exists) until it reaches the rotation event (in my case midnight).
Or, maybe, there is such an option and I couldn't find it?

Another feature "request", if I may smile
Would be nice to have an option to keep rotated files uncompressed (i.e. raw format, not .synlz) without writing my own OnRotate event, for ex. as a property with default value true:

property CompressRotatedFiles: boolean read FCompressRotatedFiles write FCompressRotatedFiles;

If false - just don't call FileSynLZ() and don't append '.synlz' extension.
It's useful when looking for some specific log entry and don't have to UnSynLz all files.

Thanks.

#13 Re: mORMot 1 » Create function in Oracle » 2020-07-31 09:26:57

StripSemicolon by default is true.
When user does not want to trim semicolon for some specific statements (like me) - it sets it to false.

Edit: wasn't this the purpose of StripSemicolon property? To trim or not the semicolon depending on the case?

#14 Re: mORMot 1 » Create function in Oracle » 2020-07-31 09:05:01

Just downloaded the latest code and it does not work, because I need semicolon not to be trimmed, but it is by below code (SynDBOracle.pas, line 3416):

        L := Length(fSQLPrepared);
        while (L>0) and (fSQLPrepared[L] in [#1..' ',';']) do
        if (fSQLPrepared[L]=';') and (L>5) and IdemPChar(@fSQLPrepared[L-3],'END') then
          break else // allows 'END;' at the end of a statement
          dec(L);    // trim ' ' or ';' right (last ';' could be found incorrect)
        if L <> Length(fSQLPrepared) then
          fSQLPrepared := copy(fSQLPrepared,1,L); // trim right ';' if any

My workaround is to check StripSemicolon flag before trimming, otherwise leave fSQLPrepared as is.

      if StripSemicolon then
      begin
        L := Length(fSQLPrepared);
        while (L>0) and (fSQLPrepared[L] in [#1..' ',';']) do
        if (fSQLPrepared[L]=';') and (L>5) and IdemPChar(@fSQLPrepared[L-3],'END') then
          break else // allows 'END;' at the end of a statement
          dec(L);    // trim ' ' or ';' right (last ';' could be found incorrect)
        if L <> Length(fSQLPrepared) then
          fSQLPrepared := copy(fSQLPrepared,1,L); // trim right ';' if any
      end;

#15 Re: mORMot 1 » Create function in Oracle » 2020-07-30 21:18:34

The problem still exists and the issue is in ReplaceParamsByNames() function (SynDB.pas), it strips the last semicolon regardless of the TSQLDBStatement.StripSemicolon property.
The workaround:
Change function signature:

function ReplaceParamsByNames(const aSQL: RawUTF8; var aNewSQL: RawUTF8; const aStripSemicolon: boolean = true): integer;

Update function's code (add the aStripSemicolon check)

  if aStripSemicolon then
    while (L>0) and (aSQL[L] in [#1..' ',';']) do
      if (aSQL[L]=';') and (L>5) and IdemPChar(@aSQL[L-3],'END') then
        break else // allows 'END;' at the end of a statement
        dec(L);    // trim ' ' or ';' right (last ';' could be found incorrect)

Update TSQLDBOracleStatement.Prepare (SynDBOracle.pas)  call to ReplaceParamsByNames():

fPreparedParamsCount := ReplaceParamsByNames(aSQL,oSQL,StripSemicolon);

#16 mORMot 1 » TSynMapFile on a .dll » 2019-09-11 07:54:52

dexter
Replies: 0

Hi,

I'm trying to get the call stack of handled exceptions (using JclDebug).
It will fill Exception.StackInfo property.

When printing Exception.StackTrace - it works perfectly

(006C21D0){t24_odbc.dll} [036E31D0] uStmtImpl.TStmtImpl.AttachSQLiteDB$qqrv (Line 619, "uStmtImpl.pas" + 9) + $0
(006C0D25){t24_odbc.dll} [036E1D25] uStmtImpl.TStmtImpl.SQLiteExecute$qqrx17System.WideString (Line 241, "uStmtImpl.pas" + 1) + $3
(006C1B5D){t24_odbc.dll} [036E2B5D] uStmtImpl.TStmtImpl.OpenNextFile$qqrv (Line 514, "uStmtImpl.pas" + 48) + $8
(006C16B8){t24_odbc.dll} [036E26B8] uStmtImpl.TStmtImpl.Execute$qqrv (Line 434, "uStmtImpl.pas" + 19) + $3
(00629AD4){t24_odbc.dll} [0364AAD4] uOdbcApi.SQLExecDirectW$qqs42System.%DelphiInterface$15Ustmtintf.IStmt%pbi (Line 1170, "uOdbcApi.pas" + 12) + $5

When trying to use TSynMapFile - stack trace is empty

Map := TSynMapFile.Create;
try
  writeln(Map.FindLocation(PtrUInt(aException.StackInfo)));
finally
  Map.Free;
end;

Am I using TSynMapFile wrongly?

#17 Re: mORMot 1 » Create function in Oracle » 2018-11-14 10:50:02

Thanks mpv, good to know about StripSemicolon.

Anyway, it does help with the issue.

#18 Re: mORMot 1 » Create function in Oracle » 2018-11-14 08:55:59

Creating tables is working fine for me as well.

I have noticed something: if I remove the last space in create procedure statement (leaving semicolon as last char) - then semicolon is removed from the statement (or SynLog does not display it?). With space at the end - the semicolon is present (like in my first message).

20181114 08533932 SQL   TSQLDBOracleStatement(00CB5E40) CREATE OR REPLACE PROCEDURE ORA_POC(MAIN_TABLE IN VARCHAR2, REC_COUNT IN NUMBER, BATCH_SIZE IN NUMBER, COMMAND IN VARCHAR2, RESULT OUT VARCHAR2) AS LANGUAGE JAVA NAME 'OraMain.selectTable(java.lang.String, int, int, java.lang.String, java.lang.String[])'
20181114 08533932 warn  ORA-24344: success with compilation error

Edit: adding line feeds inside statement did not help.

#19 mORMot 1 » Create function in Oracle » 2018-11-07 15:29:42

dexter
Replies: 17

Hi,

I'm trying to create a function with OCI with no success.

Code:

DB.ExecuteNoResult(
  'CREATE OR REPLACE FUNCTION ORA_POC(MAIN_TABLE IN VARCHAR2, REC_COUNT IN NUMBER, BATCH_SIZE IN NUMBER) RETURN VARCHAR2' +
  ' AS LANGUAGE JAVA' +
  ' NAME ''OraMain.selectTable(java.lang.String, int, int) return java.lang.String''; ', []);

(DB is TSQLDBOracleConnectionProperties);

Output:

20181107 15232619 SQL   TSQLDBOracleStatement(02985E40) CREATE OR REPLACE FUNCTION ORA_POC(MAIN_TABLE IN VARCHAR2, REC_COUNT IN NUMBER, BATCH_SIZE IN NUMBER) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'OraMain.selectTable(java.lang.String, int, int) return java.lang.String';
20181107 15232619 warn  ORA-24344: success with compilation error

Error from Oracle:

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   ;
The symbol ";" was substituted for "end-of-file" to continue.

Calling same statement using JDBC works fine.

#20 mORMot 1 » PosEx against PUTF8Char » 2018-09-26 14:35:19

dexter
Replies: 1

Hi,

how ca I do a PosEx to search inside a PUTF8Char (and avoid _LStrFromPCharLen) ?

#21 mORMot 1 » TSQLRequest.Bind for PUTF8Char » 2018-05-14 14:15:28

dexter
Replies: 0

Hi,

would be nice to have TSQLRequest.Bind for PUTF8Char strings as well, similar to TSQLDBSQLite3Statement.BindTextP:

procedure TSQLRequest.Bind(Param: Integer; Data: PUTF8Char; Size: integer);
begin
  sqlite3_check(RequestDB,sqlite3.bind_text(Request,Param,Data,Size, nil),'bind_text');
end;

#22 Re: mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2018-01-05 09:10:44

No, it does not.

I have noticed another thing: with one parameter everything is fine, with 2 it's not.

// this one fails in Win64 on second call
  Prop.Execute('SELECT * FROM fbnk_account t where t.recid = ? or t.recid = ?', ['1', '2']);

// this one is OK in Win64
Prop.Execute('SELECT * FROM fbnk_account t where t.recid = ?', ['1']);

#23 Re: mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2018-01-04 12:05:55

Hi ab,

I managed to reproduce the problem.
See below the demo project with inline comments:

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  SynDB, SynDBOracle,
  System.SysUtils;

var
  Prop: TSQLDBConnectionPropertiesThreadSafe;

procedure RunSelect();
begin
// this one fails (when runs second time) in Win64 because of parameters, in Win32 is OK
  Prop.Execute('SELECT table_name FROM dba_tables where owner = ? and table_name = ?', ['1', '2']);

// this one is OK in both Win32 and Win64
//  Prop.Execute('SELECT table_name FROM dba_tables where owner = ''1'' and table_name = ''2''', []);
end;

procedure TestOCI();
begin
  Prop := TSQLDBOracleConnectionProperties.Create('OraServer/OraDB', '', 'user', 'password');
  try
    RunSelect();
    writeln('OK');
  finally
// if remove Prop.Free - it works OK in all cases (with or without select parameters)
    Prop.Free;
  end;
end;

begin
{$IFDEF Win64}
  SynDBOracleOCIpath := '.\Oracle12_x64';
{$ELSE}
  SynDBOracleOCIpath := '.\Oracle12_x32';
{$ENDIF}
  try
    TestOCI;
    TestOCI;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  readln;
end.

The output is:

OK
ESQLDBOracle: TSQLDBOracleLib error: OCI-21560: argument 10 is null, invalid, or out of range

#24 Re: mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2018-01-04 07:47:02

Looks  like it's project specific issue.
I have just created an empty project which does a simple select in x64 mode and it works fine.
Perhaps some project compiler settings are creating the original issue.

#25 Re: mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2018-01-03 19:16:37

Hi ab,

I have updated the mORMot from latest master and I'm getting now access violation:
20180103 19120122 EXC   EAccessViolation ("Access violation at address 000007FEC1D85CC4 in module 'OraOCIICUS12.dll'. Wr
ite of address 0000000000000018") at 000007FEC1D85CC4  stack trace API 004164B8 System.@RaiseAgain (21565) 0195CCDC SynD
BOracle.TSQLDBOracleStatement.Prepare (3396) 019545B3 SynDBOracle.TSQLDBOracleConnection.NewStatementPrepared (2094) 007
16F90 SynDB.TSQLDBConnectionProperties.NewThreadSafeStatementPrepared (4850) 0071643A SynDB.TSQLDBConnectionProperties.E
xecute (4719) 0195E72D uOracleProvider.TOracleProvider.CheckIfConfigTableExists (144) 0195E8C5 uOracleProvider.TOraclePr...

It happens on line 1948 of SynDBOracle, EnvNlsCreate call:

    if fEnv=nil then
      // will use UTF-8 encoding by default, in a multi-threaded context
      // OCI_EVENTS is needed to support Oracle RAC Connection Load Balancing
      EnvNlsCreate(fEnv,Props.EnvironmentInitializationMode,
        nil,nil,nil,nil,0,nil,OCI_UTF8,OCI_UTF8);

Hope this helps.
In x32 platform is fine.

#26 Re: mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2017-12-17 08:54:42

Yes, I'm pretty sure, I debugged until this line, tried to step over it and got exception.
Maybe Delphi is not very accurate when debugging 64bit app, but certainly the error is in Connect method, because it fails during connection.

Did you manage to replicate the issue?

#27 mORMot 1 » OCI-21560 error with Delphi 10.1 x64 app » 2017-12-16 21:54:58

dexter
Replies: 21

Hi,

when I tried to convert my app from x32 to x64 platform I faced the following issue:
during my first select from Oracle I'm getting the error: {"ESQLDBOracle(0B293D90)":{"Message":"TSQLDBOracleLib error: OCI-21560: argument 10 is null, invalid, or out of range"}}
stack trace API 014279D9 SynDBOracle.TSQLDBOracleStatement.Prepare (3395) 0141F2C3 SynDBOracle.TSQLDBOracleConnection.NewStatementPrepared (2094)
0136B0C0 SynDB.TSQLDBConnectionProperties.NewThreadSafeStatementPrepared (4850) 0136A56A SynDB.TSQLDBConnectionProperties.Execute (4719)
01428CAD uOracleProvider.TOracleProvider.CheckIfConfigTableExists (103) 01428E45 uOracleProvider.TOracleProvider.InternalConnect (111)
010BCC3B uAbstractProvider.TAbstractProvider.Connect (110) 010C0F44 uAbstractProvider.TProviderList.Get (443)

I have tracked down to the line which fails: SynDBOracle.pas.TSQLDBOracleConnection.Connect method (1976):

    Check(self,nil,TypeByName(fEnv,fError,fContext,Pointer(type_owner_name),length(type_owner_name),
      Pointer(type_NymberListName),length(type_NymberListName),nil,0,OCI_DURATION_SESSION,OCI_TYPEGET_HEADER,
      fType_numList),fError);

The select looks like this:

  if not FProp.Execute('SELECT table_name FROM dba_tables where owner = ? and table_name = ?',  [UpperCase(GetSchema()), GetConfigTableName()]).Step then
...


In x32 bit mode everyghing is fine.
OCI is version 12.n, connecting to Oracle 10

Hope it helps.

Regards.

#28 Re: mORMot 1 » SOA client with multiple threads » 2017-10-08 20:22:32

Sorry, forgot to mention: yes, access violation is on the client side.

Solution 1: Do You mean to put a lock/mutex for all calls to RemoteService methods?

Solution 2: Having separate TSQLHttpClient for each thread did not help. Does it need lock/mutex for RemoteService method calls as well?

#29 mORMot 1 » SOA client with multiple threads » 2017-10-08 16:13:38

dexter
Replies: 2

Hi,

I have a SOA server (TSQLRestServerFullMemory) which defines service IMyService as follows:

MyServer.ServiceDefine(TMyServiceImpl, [IMyService], sicShared);

I have a SOA client (TSQLHttpClient) which calls some methods of above interface periodically (1 call per second).

FClient.ServiceDefine([IMyService], sicShared);
RemoteService := FClient.Service<IMyService>;

 
When client uses only one thread to call RemoteService methods - everything works fine.
When I create 10 threads which do the same - I'm getting access violations.
 
I have tried different ways with no success:

1. use one TSQLHttpClient for all threads

2. create TSQLHttpClient for each thread

3. use sicPerThread instead of sicShared

I have a feeling that I'm missing something, but cannot figure out for couple of days already.
Any help is appreciated.

Thanks.

#31 mORMot 1 » Returning a JSON object as RawJSON from SOA » 2017-06-14 06:50:24

dexter
Replies: 2

Hi,

I have a server function which returns a RawJSON string:

function Connect(const aUrl: RawUTF8): RawJSON;

Function result from server:
20170614 06363933 ret           uHTTPServer.TOdbcRestServer(7EF49BE0) {Result:{"SessionId":2,"ProductName":"","ProductVer":"","MajorVer":0,"MinorVer":0}}

On client side, when I call Connect I expect to receive as result value: {"SessionId":2,"ProductName":"","ProductVer":"","MajorVer":0,"MinorVer":0}
But it raises error in FakeCall: Unexpected parameter "SessionId".
Looks like it searches for a var/out parameter SessionId, which is obviously missing.

How can I return back a JSON string from a server function?

#32 mORMot 1 » Exception from service » 2016-12-30 07:56:22

dexter
Replies: 1

Hi,

my function raises an exception on server side.
Java client receives the JSON object: {  "errorCode":500,  "error":  {"Exception":{"Exception":"Field \"abc\" not found."}}  }

Question is: why there are 2 levels of "Exception"? Shouldn't the second one (field name) be something like "Message" ?
Ex. {  "errorCode":500,  "error":  {"Exception":{"Message":"Field \"abc\" not found."}}  }

Regards,
Alex.

#33 Re: mORMot 1 » Calling mORMot webservice from Java » 2016-10-05 11:48:10

willo wrote:

Dexter,

I've never tried using it like that. From our use cases it's always been RESTfull, so the method to call is encoded in the URI, while the paramters are either POSTed or encoded as GET parameters (.../calculator/add?n1=1&n2=2)

Hope this helps

Yes, it's working this way. Thanks.

#34 mORMot 1 » Calling mORMot webservice from Java » 2016-09-29 15:02:38

dexter
Replies: 6

Hi,

I'm trying to consume a mORMot webservice from java.
In documentation is mentioned that mORMot supports JSON-RPC.
Is it about the official JSON-RPC 2.0 (https://en.wikipedia.org/wiki/JSON-RPC) ?

I'm trying to call Calculator.Add method from 14 - Interface based services examples (removed authentification from server for the time being) and I get http error code 400, "Bad request".

The JSON request is built according to JSON-RPC 2.0 standards: {"id":"req-001","method":"Add","params":{"n1":1,"n2":2},"jsonrpc":"2.0"}
Tried {"id":"req-001","method":"Calculator.Add","params":{"n1":1,"n2":2},"jsonrpc":"2.0"} as well with same result.

Is this format accepted by mORMot? If not, how shall I build the JSON request in order to get the expected result "{"result":[3]}"?

Or,

is there any other option to call it?

Regards,
Alex.

#35 Re: mORMot 1 » FPC Crosscompile i386/win32 -> powerpc/aix » 2016-01-23 15:50:49

ab wrote:

So perhaps we may try to replace most LINUX conditionals for FPC specific code to UNIX...

Agree, would be very good!

Let us know please when it's done, so we can test it.

#36 Re: mORMot 1 » FPC Crosscompile i386/win32 -> powerpc/aix » 2016-01-23 10:11:18

Fails as well, now in SynCommons:

function GetTickCount64: Int64;
begin
  result := SynFPCLinux.GetTickCount64; // <-- here, saying unknown identifier SynFPCLinux
end;

SynFPCLinux is included only when $Linux is defined.

#37 mORMot 1 » FPC Crosscompile i386/win32 -> powerpc/aix » 2016-01-22 14:30:33

dexter
Replies: 12

Hi,

I am able to crosscompile i386/win32 -> i386/linux my mORMot application.

Is it planned to support powerpc/aix?


Edit:
I'm compiling under FPC 3.1.1
It fails on line 225 of file Synopse.inc:  {$ASMMODE INTEL} // as Delphi expects, and I use to write

I tried to define PUREPASCAL, it did not help.

#38 Re: mORMot 1 » TestSQL3 results with FPC/trunk » 2016-01-21 13:35:32

I hope someone from mORMot team raised a ticket for Free Pascal team smile

#39 mORMot 1 » TestSQL3 results with FPC/trunk » 2016-01-21 12:36:32

dexter
Replies: 2

Hi,

I have a lot of errors while running TestSQL3 compiled with FPC/trunk/win32 mode.

I have included the provided TestSQL3FPCInterfaces into uses clause of the TestSQL3.dpr project.


1.3. Cryptographic routines:
[..]
!  - Base64: 3 / 11,994 FAILED  205.87ms
  Total failed: 3 / 26,573  - Cryptographic routines FAILED  581.09ms

1.4. Compression:
[..]
!  - GZIP format: 1 / 19 FAILED  875.40ms
!  - ZIP format: 7 / 64 FAILED  3.46s
!  - SynLZO: 1,000 / 3,006 FAILED  163.89ms
!  - SynLZ: 989 / 32,221 FAILED  846.73ms
  Total failed: 1,997 / 35,322  - Compression FAILED  5.79s


2. mORMot

2.1. File based:
[..]
!  - TSQLRestClientDB: 4 / 608,195 FAILED  3.64s
  Total failed: 4 / 792,588  - File based FAILED  4.10s

2.2. File based memory map:
[..]
!  - TSQLRestClientDB: 4 / 608,194 FAILED  3.62s
  Total failed: 4 / 792,582  - File based memory map FAILED  4.08s

2.3. File based WAL:
[..]
!  - TSQLRestClientDB: 4 / 608,195 FAILED  3.75s
  Total failed: 4 / 792,588  - File based WAL FAILED  4.21s

2.4. Memory based:
[..]
!  - TSQLRestClientDB: 4 / 676,502 FAILED  4.60s
  Total failed: 4 / 1,000,890  - Memory based FAILED  6.07s

2.5. Basic classes:
!  - TSQLRecord: 5 / 80 FAILED  819us
[..]
!  - TSQLRestServerFullMemory: 370,119 / 640,135 FAILED  6.09s
  Total failed: 370,124 / 640,431  - Basic classes FAILED  6.10s

2.6. Client server access:
[..]
!  - Local window messages: 1 / 2 FAILED  2.97ms
[..]
  Total failed: 1 / 25,017  - Client server access FAILED  2.84s

2.7. Service oriented architecture:
[..]
!  - Service initialization: 1 / 17 FAILED  1.89ms
[..]
!  - Server side: 1 / 3 FAILED  246us
! Service oriented architecture - Client side REST
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create(): IComplexCalculator interface or TSQLRestRoutingREST routing not supported by server:
{
"errorCode":400,
"errorText":"Bad Request"
}
! Service oriented architecture - Client side REST as JSON object
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side REST sessions stats
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
  - Client side REST locked: 3 assertions passed  1.51ms
  - Client side REST main thread: 3 assertions passed  1.49ms
! Service oriented architecture - Client side REST background thread
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side REST weak authentication
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side REST basic authentication
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side REST custom record layout
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side REST service log to DB
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Client side JSONRPC
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create: IComplexCalculator.TestBlob sicClientDriven mode not allowed with TServiceCustomAnswer
result
! Service oriented architecture - Test over HTTP
! Exception EServiceException raised with messsage:
!  TServiceFactoryClient.Create(): IComplexCalculator interface or TSQLRestRoutingREST routing not supported by server:
{
"errorCode":400,
"errorText":"Bad Request"
}
!  - Security: 52 / 135 FAILED  2.70ms
  - Mocks and stubs: 30,030 assertions passed  85.70ms
  Total failed: 58 / 567,460  - Service oriented architecture FAILED  199.52ms

2.8. Bidirectional remote connection:
[..]
! Bidirectional remote connection - SOA callback via JSON websockets
! Exception EInterfaceFactoryException raised with messsage:
!  TInterfacedObjectFakeClient.FakeCall(IBidirService.TestCallback) failed: '{
"errorCode":500,
"error":
{"EAccessViolation":{"EAccessViolation":"Access violation"}}
}'
! Bidirectional remote connection - SOA callback via binary websockets
! Exception EInterfaceFactoryException raised with messsage:
!  TInterfacedObjectFakeClient.FakeCall(IBidirService.TestCallback) failed: '{
"errorCode":500,
"error":
{"EAccessViolation":{"EAccessViolation":"Access violation"}}
}'
  - TRecordVersion: 20,068 assertions passed  144.57ms
  Total failed: 0 / 29,366  - Bidirectional remote connection PASSED  288.04ms

2.9. External database:
  - TQuery: 2,003 assertions passed  6.29ms
! External database - SynDBRemote
! Exception ESQLDBRemote raised with messsage:
!  You do not have the right to be here
[..]
  Total failed: 0 / 789,413  - External database PASSED  6.84s

2.10. Multi thread process:
[..]
!  - TSQLRestClientURIMessage: 18 / 40 FAILED  58.06ms
     1=63251/s  2=61022/s  5=37379/s  10=20198/s
  - Windows API: 4,814 assertions passed  503.93ms
     1=2518/s  2=4879/s  5=5509/s  10=6283/s  30=7400/s  50=6838/s
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
  $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
  $004175BB
Runtime error 204 at $004175BB
Runtime error 204 at $004175BB
  $004175BB
Runtime error 204 at $004175BB
  $004175BB
  $004175BB
  $004175BB
  $004175BB
  $004175BB
  $004175BB

  $004175BB
  $004175BB
  $004175BB
  $004175BB

  $004175BB
  $004175BB

  $004175BB












  $00641A9C
No heap dump by heaptrc unit
  $00641D07
Exitcode = 204
  $0042EE5B
  $0042F11C
  $00430FDD
  $00430D6D
  $00641995
  $0041037E
  $7506338A

Marked memory at $0552C12C invalid
Wrong size : 6808248 allocated 6374192 freed
  $7506338A
  $772B9882
  $772B9855

#40 Re: mORMot 1 » TestSQL3 on FPC/trunk » 2016-01-21 12:13:40

After applying the patch #5db8673387, compilation is fine now.
Thanks.

#41 mORMot 1 » TestSQL3 on FPC/trunk » 2016-01-20 16:23:22

dexter
Replies: 6

Hi,

just downloaded FPC/trunk and the night build of mORMot.

FPC fails to compile TestSQL3 or any other (ex. Project04Server) under Win7 in default(win32) mode with many errors like:
TestSQL3.dpr(186,1) Error: Undefined symbol: __imp___endthreadex
TestSQL3.dpr(186,1) Error: Undefined symbol: __imp___beginthreadex

etc.

In linux mode is fine.
With previous FPC (stable) everything was OK.

What might be the reason?

#42 Re: mORMot 1 » Get instance of service » 2015-10-23 08:42:27

The dependency is for TServer (which is class(TInterfacedObject, IServer).
That's why I want to add the TServer to TInterfaceResolverInjected and use it all over the project to access IServer, without doing uses UnitServer.

And I cannot obtain the TServer instance when doing TSQLRestServer.ServiceDefine().
Can I get it from TSQLRestServer somehow?

#43 Re: mORMot 1 » Get instance of service » 2015-10-23 07:31:20

It does not help me, since I need to access the server interface outside the service context (i.e. outside TServiceFactoryServer.ExecuteMethod).

Here is my goal: I want to reduce coupling in my project.

I have UnitServer where Server : TSQLRestServer is defined.

In other units (UnitServerA, UnitServerB, etc.) I need to access the IServer and I don't want to include UnitServer in their uses clause.

So my idea is to define a service container (TInterfaceResolverInjected) in a separate unit and add there the implementations of all services I need to acces from outside (TInterfaceResolverInjected.InjectInstance()).

After that, in all units (UnitServerA, UnitServerB, etc.) I just do TInterfaceResolverInjected.Resolve() to access the service.

The problem is that TInterfaceResolverInjected.InjectInstance() needs the instance of TServer, which is created by Server.ServiceDefine() and this instance I'm trying to obtain.

Hope it clarifies.

Regards.

#44 mORMot 1 » Get instance of service » 2015-10-22 17:17:17

dexter
Replies: 5

Hi,

I have a REST Server:

Server                                : TSQLRestServer;

I have a class TServer which implements service IServer:

TServer = class(TInterfacedObject, IServer)

I define the service IServer:

Server.ServiceDefine(TServer, [IServer], sicShared);

I can obtain the interface which implements the service:

Server.Services.Resolve(IServer, Srv); // Srv is declared as IServer

My question is: is there a way to obtain the instance of TServer which implements the IServer interface?

Regards,
Alex.

#45 Re: mORMot 1 » SynCrtSock.TWinINet.InternalConnect » 2015-07-21 10:37:16

I'm using TSQLHttpClient, but while browsing the code I noticed that typo.
Thanks.

#46 Re: mORMot 1 » mORMotHttpClient.TSQLHttpClientRequest.InternalCheckOpen » 2015-07-21 10:34:23

Looks like it was fixed in some later builds.
I have the build from 24.04.2015

#47 mORMot 1 » mORMotHttpClient.TSQLHttpClientRequest.InternalCheckOpen » 2015-07-21 08:08:40

dexter
Replies: 2

Hi,

below is a fragment from TSQLHttpClientRequest.InternalCheckOpen method:

function TSQLHttpClientRequest.InternalCheckOpen: boolean;
begin
[...]
      fRequest := fRequestClass.Create(fServer,fPort,fHttps,
        fProxyName,fProxyByPass,fSendTimeout,fReceiveTimeout); // there are 7 parameters
[...]


THttpRequest constructor is declared as follows (with 8 parameters):

    constructor Create(const aServer, aPort: SockString; aHttps: boolean;
      const aProxyName: SockString=''; const aProxyByPass: SockString='';
      ConnectionTimeOut: DWORD=HTTP_DEFAULT_CONNECTTIMEOUT;
      SendTimeout: DWORD=HTTP_DEFAULT_SENDTIMEOUT;
      ReceiveTimeout: DWORD=HTTP_DEFAULT_RECEIVETIMEOUT); virtual;


Because of missing the ConnectionTimeout paramter, fSendTimeout is assigned to ConnectionTimeout, fReceiveTimeout is assigned to SendTimeout and ReceiveTimeout is left with default value HTTP_DEFAULT_RECEIVETIMEOUT.

This leads to issue when I need to set ReceiveTimeout with following command:

  Client := TSQLHttpClient.Create(Config.Param['Host'], Config.Param['Port'], Model, false, '', '', 60000, 90000);

The last value for ReceiveTimout (90000) will not be used later and will remain as remain default HTTP_DEFAULT_RECEIVETIMEOUT (30000).

#48 mORMot 1 » SynCrtSock.TWinINet.InternalConnect » 2015-07-21 07:59:50

dexter
Replies: 2

Hi,

below is the fragment from TWinINet.InternalConnect method:

procedure TWinINet.InternalConnect(ConnectionTimeOut,SendTimeout,ReceiveTimeout: DWORD);
[...]
  InternetSetOption(fConnection,INTERNET_OPTION_SEND_TIMEOUT,
    @ConnectionTimeOut,SizeOf(ConnectionTimeOut));
  InternetSetOption(fConnection,INTERNET_OPTION_CONNECT_TIMEOUT,
    @SendTimeout,SizeOf(SendTimeout));
[...]


Is it OK to assign ConnectionTimeOut to INTERNET_OPTION_SEND_TIMEOUT parameter
and
SendTimeout to INTERNET_OPTION_CONNECT_TIMEOUT ?

#50 Re: mORMot 1 » TDocVariantData.Value vs TDocVariantData.Values » 2015-05-18 12:17:16

Hi,

thanks for answer.

Actually I was trying initially to access by Name, i.e. V2 := TDocVariantData(V.Value['DATA']).

If V2 := TDocVariantData(V.Values[0]) keeps the Kind = dvArray, why V.Value['DATA'] does not?

Isn't V.Value at the end taking from the same V.Values?

Board footer

Powered by FluxBB