#1 Re: mORMot 1 » sqlite - index in table not found » 2015-09-01 11:02:14

How can I force to run the method InitializeTable? (cause my model already created the table on database)

I was trying run CreateMissingTables (TSQLRestServerDB) with parameter user version and without options, but it not work - maybe I made confusion about that.

#3 mORMot 1 » sqlite - index in table not found » 2015-08-27 18:35:03

dorival
Replies: 3

My system started to slow performance... and investigating the slow performance, I not found a index in a table.
In my model, I have:

  TMyTable = class( TSQLRecord )
    ...
  published
    property Field1 : Integer          read FField1 write FField1 stored AS_UNIQUE;
    property Field2 : Integer index 10 read FField2 write FField2;
  end;

and in my database, in the dump file I found just de index of "Field1". The second index not exist (at least I didn't find it).
I created the index with command below:

CREATE INDEX IF NOT EXISTS IndexMyTableField2 ON MyTable(Field2); 

and the system performance went back to normal...

Did I use de corret way to create a index (in the second example)?

#4 Re: mORMot 1 » sqlite - recover a database corrupted (backup/restore) » 2015-08-18 11:28:26

Hi,

Just you know, all of cases (corrupted database) was physical problem in the HDD.
Even with this problem, after run CHKDSK /F/R, I got access the database file and recover the information.

#5 Re: mORMot 1 » sqlite - recover a database corrupted (backup/restore) » 2015-08-08 13:58:52

Ok Ab,

I was using just:
Synchronous := smFull;

now, I will include:
Lockingmode := lmExclusive;


I had some problems and I could not look at all yet. In fact, I could analyze only two situations - the first the problem was a defect in harddisk - obviously , in this case the only solution is to restore the backup.

in the dump file I found this

...
INSERT INTO "MYTABLE" BLA BLA...
/**** ERROR: (10) disk I/O error *****/
INSERT INTO "MYTABLE" BLA BLA...
....

The second case I'm with the corrupted database and I can restore through the following commands:

sqlite3.exe mydatabase.db3 ".dump" > mydatabase.sql

...edit mydatabase.sql and replace 'COLLATE SYSTEMNOCASE', 'COLLATE NOCASE' and 'COLLATE ISO8601' for nothing and ...

sqlite3.exe mynewdatabase.db3 < mydatabase.sql

in the mydatabase.sql I found this:

...
INSERT INTO "MYTABLE" BLA BLA...
/**** ERROR: (11) database disk image is malformed *****/
INSERT INTO "MYTABLE" BLA BLA...
....

the source of the corruption of this database still can not identify - perhaps for not having used Lockingmode : = lmExclusive ;.

#6 Re: mORMot 1 » sqlite - recover a database corrupted (backup/restore) » 2015-08-08 11:13:39

btw, does anyone know how to simulate problems in a database sqlite?

What I do is fix problems after they happen.
I want to try to anticipate what might happen to already implement in my application a "AutoRecover".

#8 Re: mORMot 1 » sqlite - recover a database corrupted (backup/restore) » 2015-08-06 21:27:23

Ok AB, thanks.

Now I will use the BackupBackground.

But if I have a database corrupted and unfortunately I have not ran the backup. I could do the following replacement before restoring the base?
Replace 'COLLATE SYSTEMNOCASE' by ''
Replace 'COLLATE NOCASE' by ''
and replace 'COLLATE ISO8601' by ''

If I do this replacement I can restore the database...

C:\myapplication>sqlite3.exe mynewdatabase.db3 < mydatabase.sql

... but I still do not know the consequence of it.

Could you tell me what problems I can face or that detail is set automatically ?

#9 mORMot 1 » sqlite - recover a database corrupted (backup/restore) » 2015-08-05 22:00:14

dorival
Replies: 10

I have a corrupt SQLite database.

I'm trying to use the "sqlite3.exe" tool to recover it.
I can create the backup of the base but when I try to restore, generates the error below.

C:\myapplication>sqlite3.exe mydatabase.db3 ".dump" > mydatabase.sql
C:\myapplication>sqlite3.exe mynewdatabase.db3 < mydatabase.sql
Error: near line 3: no such collation sequence: SYSTEMNOCASE
Error: near line 4: no such table: TableABC
Error: near line 6: no such collation sequence: SYSTEMNOCASE
Error: near line 7: no such collation sequence: ISO8601
Error: near line 8: no such collation sequence: ISO8601
Error: near line 9: no such collation sequence: ISO8601
Error: near line 11: no such collation sequence: ISO8601
Error: near line 12: no such collation sequence: ISO8601
Error: near line 13: no such collation sequence: ISO8601
Error: near line 14: no such collation sequence: ISO8601
Error: near line 15: no such collation sequence: ISO8601
Error: near line 16: no such collation sequence: SYSTEMNOCASE
Error: near line 17: no such collation sequence: ISO8601
...

The database above is ok. I'm trying to find a way to perform the backup and restore to later try to recover the corrupted database.

I was reading about "Column collations" but I did not find how to set it used to sqlite3.exe tool.

Please, someone can help me?

#12 mORMot 1 » how is the best way to stop a HTTP server? » 2014-06-25 20:29:27

dorival
Replies: 6

Hi,
I have one server (http api) and n clients.
My server is based on TSQLHttpServer, my client is based on TSQLHttpClient and some services that are consumed by clients.

Sometimes I need to stop de server, but I cannot just kill the server, 'cause maybe some important process are runing.

To stop the server I implemented:
- delete all users to stop new connections;
- wait that all request finished;
- and finally, freeandnil on my server object.

Below my code:

procedure TMyServer.StopServer;
var
  oSQLAuthUser: TSQLAuthUser;
begin
  oSQLAuthUser := TSQLAuthUser.Create;
  try
    oSQLAuthUser.FillPrepare(oSQLRestServerFullMemory);
    while (oSQLAuthUser.FillOne) do
      oSQLRestServerFullMemory.Delete(TSQLAuthUser, oSQLAuthUser.ID); // delete all users. This way I stop new clients connections.
  finally
    oSQLAuthUser.Free;
  end;
    while fDBServers[0].Server.Stats.ClientsCurrent > 0 do // until have clients, just wait...
      sleep(1000);
end;

And ...

procedure TMyServerAPP.StopServer;
begin
  fMyServer.StopServer;
  FreeAndNil(fMyServer);
end;

It's work... but I imagine that's not the best way to do this... Someone have any suggestion?
Thanks by your attention,

Dorival

#13 Re: mORMot 1 » using different version of a "DTO" class » 2014-06-10 20:52:36

well I changed de method (mormot.pas)

function JSONToObject(var ObjectInstance; From: PUTF8Char; var Valid: boolean; TObjectListItemClass: TClass=nil; 
Options: TJSONToObjectOptions=[]): PUTF8Char;

...to...

function JSONToObject(var ObjectInstance; From: PUTF8Char; var Valid: boolean; TObjectListItemClass: TClass=nil; Options: 
TJSONToObjectOptions=[j2oIgnoreUnknownProperty]): PUTF8Char;

(Options default j2oIgnoreUnknownProperty ).

It´s work for me. Someone knows if can it do some problem?

Dorival

#14 Re: mORMot 1 » using different version of a "DTO" class » 2014-06-10 12:28:39

Hello,

Using a custom reader method bellow:

class function TServerClass.MyClassCustomReader(const aValue: TObject; aFrom: PUTF8Char; var aValid: Boolean; aOptions: TJSONToObjectOptions): PUTF8Char;
var 
  oDTOMyClass: TDTOMyClass;
begin
  aOptions := aOptions + [j2oIgnoreUnknownProperty];
  result := aFrom;
  oDTOMyClass := TDTOMyClass(aValue);
  JSONToObject(oDTOMyClass, aFrom, aValid, nil, aOptions);
  oDTOMyClass := nil;
end;

...and registering the method with the code bellow:

TJSONSerializer.RegisterCustomSerializer(TDTOMyClass, MyClassCustomReader, nil);

...my code enter in a loop (of course).
JSONToObject->MyClassCustomReader->JSONToObject->MyClassCustomReader....

I need just include the j2oIgnoreUnknownProperty option. What the best way to do it without recreate another JSONToObject ?

Thanks.
Dorival

#15 Re: mORMot 1 » using different version of a "DTO" class » 2014-05-15 18:10:14

Hello AB,

on this subject, I have a question:
on an http client, how should I set the new attribute of my DTO class?

I saw that in the method ...

function TServiceMethod.InternalExecute(... 

... call the function without any parameters:

Par: JSONToObject = (Objects [IndexVar] Pair valid); 

So I changed as below so that the server does not generate an error as DTO customer has with a new attribute.

Par: JSONToObject = (Objects [IndexVar] Pair valid, nil, [j2oIgnoreUnknownProperty]); 

#17 mORMot 1 » using constructor / destrutur in class service » 2014-03-07 14:45:52

dorival
Replies: 2

Hello,

I was studying the example project located in "\lib\SQLite3\Samples\20 - DTO based service interface".

I changed TAirportService (of Project20ServerInMemory.dpr) and added constructor and destructor methods.
But when I use the interface on the client side, the constructor and destructor methods are not executed on the server side.
I can not use constructor or destructor in this type of class?
or if I need to use a constructor and destructor have any alternative?

I thank the attention.

Dorival

#18 Re: mORMot 1 » TSQLRestServerDB backup and restore SQLite » 2014-02-17 13:48:47

Hello AB,

Can I use journal or walmode to implement a real-time backup?

I would like to restore a database using a physical backup plus a journal or wal file.

Is it possible (that even with the problems in backup / restore process sqlite already reported)?

#19 Re: mORMot 1 » Client driven instance not found or deprecated » 2014-02-14 18:56:57

I thanks a lot for your feedback!

I'm testing again (now without sleep(100)) and several workstations running the client application and so far no problem :-D

Grand week-end pour vous.

#20 Re: mORMot 1 » Client driven instance not found or deprecated » 2014-02-13 16:36:14

course...

the project is very small... above the link to download de project:
http://www.sysmo.com.br/sysmo03/desenvo … r_http.rar

if you prefer just a snippet of code that I let'll post

trace of client:

...
20140213 14115619  +    TSQLHttpClientWinHTTP(02DAE910).auth
20140213 14115619  +    	TSQLHttpClientWinHTTP(02DAE910).00672725 
20140213 14115619 clnt  		TSQLHttpClientWinHTTP(02DAE910) GET root/auth?UserName=sysmo&Password=9bf7adb816db7d251deb9150606264e1ef90c5f3e5945acba8d57a1153f8674f&ClientNonce=d334ac28bec5d7c5f67a89dc512927afd4a82114c81b9d068c8a999df0ded328 status=200 state=0
20140213 14115619  -    	00.000.761
20140213 14115619 ret   	{"result":"195586981+07cd920dba2dff2bb14995d9900383c882cd388e8b04b0cd276a47559c0c96ea","logonname":"sysmo"}
20140213 14115619  -    00.000.818
20140213 14115619  +    TServiceFactoryClient(02E75690).ComunicacaoTeste._contract_
20140213 14115619  +    	TSQLHttpClientWinHTTP(02DAE910).00672725 
20140213 14115620 clnt  		TSQLHttpClientWinHTTP(02DAE910) POST root/ComunicacaoTeste._contract_?session_signature=0BA86BA5000BAA41BC3D62BD status=200 state=0
20140213 14115620  -    	00.000.592
20140213 14115620 ret   	{"result":{"contract":1}}
20140213 14115620  -    00.000.643
20140213 14115620  +    TServiceFactoryClient(02E75690).ComunicacaoTeste.SumInterface
20140213 14115620  +    	TSQLHttpClientWinHTTP(02DAE910).00672725 
20140213 14115620 clnt  		TSQLHttpClientWinHTTP(02DAE910) POST root/ComunicacaoTeste.SumInterface?session_signature=0BA86BA5000BAA41FD751CDD status=200 state=0
20140213 14115620  -    	00.001.282
20140213 14115620 ret   	{"result":{"Result":653},"id":14866}
20140213 14115620  -    00.001.329
20140213 14115620  +    TServiceFactoryClient(02E75690).ComunicacaoTeste.Inventario
20140213 14115620  +    	TSQLHttpClientWinHTTP(02DAE910).00672725 
20140213 14115620 clnt  		TSQLHttpClientWinHTTP(02DAE910) POST root/ComunicacaoTeste.Inventario/14866?session_signature=0BA86BA5000BAA41DF241A77 status=400 state=0
20140213 14115620  -    	00.000.930
20140213 14115620 ERROR 	TSQLHttpClientWinHTTP(02DAE910) POST root/ComunicacaoTeste.Inventario/14866 returned 400 Bad Request with message  {  "ErrorCode":400,  "ErrorText":"Client driven instance not found or deprecated"  } stack trace API 00609D0E 0064A804 0066EC3F 0066EAC8 006652C0 00665B76 
20140213 14115620  -    00.000.985
20140213 14115620 EXC   EInterfaceFactoryException ("Invalid fake IComunicacaoTeste.Inventario interface call: : {\r\n\"ErrorCode\":400,\r\n\"ErrorText\":\"Client driven instance not found or deprecated\"\r\n}") at 0066504A  stack trace 004C6B29 0040A132 767C339A 778E9EF2 778E9EC5 
20140213 14115621  +    TSQLHttpClientWinHTTP(02DAEB10).auth
20140213 14115621  +    	TSQLHttpClientWinHTTP(02DAEB10).TimeStamp
20140213 14115621  +    		TSQLHttpClientWinHTTP(02DAEB10).00672725 
20140213 14115621 clnt  			TSQLHttpClientWinHTTP(02DAEB10) GET root/TimeStamp status=200 state=0
20140213 14115621  -    		00.000.675
20140213 14115621 ret   		135163077367
20140213 14115621  -    	00.000.715
20140213 14115621  +    	TSQLHttpClientWinHTTP(02DAEB10).00672725 
20140213 14115621 clnt  		TSQLHttpClientWinHTTP(02DAEB10) GET root/auth?UserName=sysmo status=200 state=0
20140213 14115621  -    	00.000.463
20140213 14115621 ret   	{"result":"d334ac28bec5d7c5f67a89dc512927afd4a82114c81b9d068c8a999df0ded328"}
20140213 14115621  -    00.001.250
...

trace of server... consider only the ip 127.0.0.1

...
20140213 14115619 auth  	TAuthSession(02A6BAF0) New "User" session sysmo/195586981 created at 127.0.0.1/ED00000060000001 running Mozilla/4.0 (compatible; MSIE 5.5; Windows; Synopse mORMot 1.18 TWinHTTP)
20140213 14115619 srvr  	TServidorServicos(029ED170) GET auth -> 200
20140213 14115619  -    00.000.164
20140213 14115619  +    TServidorServicos(029ED170).root/auth?UserName=sysmo
20140213 14115619 call  	TServidorServicos(029ED170) Auth
20140213 14115619  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14863
20140213 14115619 srvr  	TServidorServicos(029ED170) GET auth -> 200
20140213 14115619  -    00.000.087
20140213 14115619  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14862
20140213 14115619 auth  	TSQLRestRoutingREST(03A72BE0) sysmo/TAuthSession(02A6C030)
20140213 14115619 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115619 auth  	TSQLRestRoutingREST(03A72EE0) sysmo/TAuthSession(02A6B970)
20140213 14115619 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115619  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14864
20140213 14115619 auth  	TSQLRestRoutingREST(03A72E60) sysmo/TAuthSession(02A6BBB0)
20140213 14115619 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115619  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14865
20140213 14115619 auth  	TSQLRestRoutingREST(03A72FE0) sysmo/TAuthSession(02A6BF70)
20140213 14115619 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115619  +    TServidorServicos(029ED170).root/ComunicacaoTeste._contract_
20140213 14115619 auth  	TSQLRestRoutingREST(03A729E0) sysmo/TAuthSession(02A6BAF0)
20140213 14115619 call  	TServidorServicos(029ED170) ComunicacaoTeste._contract_
20140213 14115619 srvr  	TServidorServicos(029ED170) POST ComunicacaoTeste._contract_ -> 200
20140213 14115619  -    00.000.075
20140213 14115620  +    TServidorServicos(029ED170).root/ComunicacaoTeste.SumInterface
20140213 14115620 auth  	TSQLRestRoutingREST(03A729E0) sysmo/TAuthSession(02A6BAF0)
20140213 14115620 call  	TServidorServicos(029ED170) ComunicacaoTeste.SumInterface
20140213 14115620 call  	TServiceFactoryServer(029BF6A0) Adding ComunicacaoTeste instance (id=14866)
20140213 14115620 srvr  	TServidorServicos(029ED170) POST ComunicacaoTeste.SumInterface -> 200
20140213 14115620  -    00.000.331
20140213 14115620  +    TServidorServicos(029ED170).root/auth?UserName=sysmo&Password=3dce52f73949785033111dbd6dc8216d8d2c1b06b0ba02ca0229a078f4502cf8&ClientNonce=d782580f356f26fad1750d718a394690f02348eb3c80f30f4425250f297c7b68
20140213 14115620 call  	TServidorServicos(029ED170) Auth
20140213 14115620 srvr  	TServidorServicos(029ED170) POST ComunicacaoTeste.Inventario -> 200
20140213 14115620  -    00.001.848
20140213 14115620 auth  	TAuthSession(02A6B730) New "User" session sysmo/195586980 created at 192.168.3.121/F30000006001008F running Mozilla/4.0 (compatible; MSIE 5.5; Windows; Synopse mORMot 1.18 TWinHTTP)
20140213 14115620 srvr  	TServidorServicos(029ED170) GET auth -> 200
20140213 14115620  -    00.000.221
20140213 14115620 srvr  	TServidorServicos(029ED170) POST ComunicacaoTeste.Inventario -> 200
20140213 14115620  -    00.001.948
20140213 14115620 call  	TServiceFactoryServer(029BF6A0) Deleted ComunicacaoTeste instance (id=14866) after -15 ms timeout (max 1800000 ms)
20140213 14115620  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14866
20140213 14115620 auth  	TSQLRestRoutingREST(03A72EE0) sysmo/TAuthSession(02A6BAF0)
20140213 14115620 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115620  +    TServidorServicos(029ED170).root/ComunicacaoTeste.Inventario/14860
20140213 14115620 auth  	TSQLRestRoutingREST(03A729E0) sysmo/TAuthSession(02A6C0F0)
20140213 14115620 call  	TServidorServicos(029ED170) ComunicacaoTeste.Inventario
20140213 14115620 srvr  	POST root/ComunicacaoTeste.Inventario/14866 ERROR=400 (Client driven instance not found or deprecated)
20140213 14115620  -    00.000.327
...

#21 Re: mORMot 1 » Client driven instance not found or deprecated » 2014-02-13 11:16:13

Well, the error is still occurring. Now there are fewer errors than the previous version, but still occurs.
In my stress test I was testing an extreme situation. included a simple sleep (100) at the end of the loop and the error stopped occur.
As my application will not work in an extreme situation, I consider enough the tests.

by the way, in tests using InstaceCreation = sicClientDriven on the server side and on the client side sicSingle generates memory issue on the server. The memory usage grows as customers consume the services. InstaceCreation = sicClientDriven on both sides solve the problem.

Thanks for attention.

#22 Re: mORMot 1 » Client driven instance not found or deprecated » 2014-02-12 17:35:38

You're the guy ... I did update to the latest version. And the error occurs stopped ... Seems to have solved the problem. 
Sorry ... I should have done the update before asking.

By the way, the InstaceCreation:
- sicClientDriven on the server side
- sicSingle on the client side
This is the safest way to implement server and client?

Thanks AB.

#23 mORMot 1 » Client driven instance not found or deprecated » 2014-02-12 16:00:45

dorival
Replies: 9

Hi AB,

I'm running some stress tests between a server TSQLHttpServer and multiple clients TSQLHttpClient to make sure that I am correctly implementing the server and client.
I created an interface with two methods.
The first method is simpler, sends two integer values as parameter and returns the sum of these values. In this case not register connection issues.
The second method I use a DTO object as a parameter. In a few moments the error occurs: "Client driven instance not found or deprecated".

Is there anything can I do to prevent this error? Or this is due to excessive amount of requests that are sent at the same time?

#24 Re: mORMot 1 » using different version of a "DTO" class » 2014-02-11 12:56:32

Hello AB,
Thank you. Sorry for not replying earlier ... I was on vacation :-).

#25 Re: mORMot 1 » using different version of a "DTO" class » 2014-01-16 19:35:28

I found this... if I change the lines bellow, my problem is resolved.

function JSONToObject(var ObjectInstance; From: PUTF8Char; var Valid: boolean;
  TObjectListItemClass: TClass=nil): PUTF8Char;
...
    P := ClassFieldPropWithParentsFromUTF8(PPointer(Value)^,PropName);
    if P=nil then
    begin
      Valid := true; // return it until is true...
      PropValue := GetJSONField(From,From,@wasString,@EndOfObject); // get value and ignore de value
      continue; //exit; // unknwown property
    end;
...

What can I do ?

#26 mORMot 1 » using different version of a "DTO" class » 2014-01-16 15:47:10

dorival
Replies: 10

Hello ab,

I have this interface to comunication between client and server.

  IClient = interface(IInvokable)
    ['{3E095FAD-5D65-4A27-82D5-6492F197F402}']
    procedure SomeMethod (AClientDTO: TClientDTO);
  end;

In the server, I have this version of TClientDTO:

TClientDTO = class(TSQLRecord)
  private
    FCode: integer;
    FName: RawUTF8;
  published
    property Code: Integer read FCode write FCode;
    property Name: RawUTF8 read FName write FName;
  end;

and the client has this version of TClientDTO (a new property):

TClientDTO = class(TSQLRecord)
  private
    FCode: integer;
    FName: RawUTF8;
    FCelfone: RawUTF8;
  published
    property Code: Integer read FCode write FCode;
    property Name: RawUTF8 read FName write FName;
    property Celfone: RawUTF8 read FCelfone write FCelfone;
  end;

when I execute the method SomeMethod in the client side, I receive the error 400 – bad request.

May be you ask me if this situation is common to me. Yes, the client can be the last version and the server can be a old version...

Well, my question is: Can I force the server ignore the property Celfone?

#27 Re: mORMot 1 » I need a help with FillPrepareMany functionality » 2013-11-04 11:17:02

Hello Ab, thanks but I think there are more things (for me at least).

I made de update and did run "SQLite3ConsoleTests".

Returned this error:

...
2. mORMot

2.1. File based:

! Exception ESynException raised with messsage:
!  sqlite3_key() expects PRAGMA mmap_size=0


Software version tested: 1.0.0.0
Synopse framework used: 1.18
SQlite3 engine used: 3.7.16.2
Generated with: Delphi XE4 compiler

Time elapsed for all tests: 21.73s
Tests performed at 04/11/2013 09:07:17

Total assertions failed for all test suits:  0 / 5,400,743
! Some tests FAILED: please correct the code.

Done - Press ENTER to Exit

#28 Re: mORMot 1 » I need a help with FillPrepareMany functionality » 2013-10-30 17:18:53

Ok ab, thanks,

I can send my "project" if you need.

#29 Re: mORMot 1 » I need a help with FillPrepareMany functionality » 2013-10-30 16:53:50

Hi,
now return the error:

'SQL logic error or missing database'

in the line below (of TSQLRecord.FillPrepareMany - mormot.pas) ...

// execute SQL statement and retrieve data
T := aClient.ExecuteList(ObjectsClass,aSQL);

aSQL contains:

'select A.RowID AID,A.Codigo A00,A.Descricao A01,A.Departamento A02,A.DataCadastro A03,
B.RowID BID,C.RowID CID,C.Codigo C00,C.Nome C01
from Produto A,ProdutoXFornecedor B,Fornecedor C
where B.Source=A.RowID and B.Dest=C.RowID and (C.Codigo=:(1000):)'

The exception is created by function "sqlite3_check" (of SynSQLite3.pas - see below).

function sqlite3_check(DB: TSQLite3DB; aResult: integer): integer;
begin
  if (DB=0) or (aResult in [SQLITE_ERROR..SQLITE_ROW-1]) then // possible error codes
    raise ESQLite3Exception.Create(DB,aResult);
  result := aResult;
end;

when the exception is created, aResult contains '1' and DB is <> '0'


The function "sqlite3_check" was called by "function TSQLRequest.Step: integer;".
and funtion Step whas called by "function Execute(aDB: TSQLite3DB; const aSQL: RawUTF8; JSON: TStream;Expand: boolean=false): PtrInt; overload;"...

#30 Re: mORMot 1 » I need a help with FillPrepareMany functionality » 2013-10-30 13:35:20

Hi,

Using:

produto.FillPrepareMany(DatabaseServer, 'DestList.Dest.Codigo=?', [], [1000]);

in the line below (of TSQLRecord.FillPrepareMany - mormot.pas) ...

// execute SQL statement and retrieve data
T := aClient.ExecuteList(ObjectsClass,aSQL);

aSQL contains:

'select A.RowID AID,A.Codigo A00,A.Descricao A01,A.Departamento A02,
A.DataCadastro A03,B.RowID BID,C.RowID CID,C.Codigo C00,C.Nome C01
from Produto A,ProdutoXFornecedor B,Fornecedor C
where B.Source=A.RowID and B.Dest=C.RowID and (C.Codigo=:(1000):)'


if I run this select in the program 'SQlite Expert Personal', for exemple, its works ok.

but in my app returns de error: 'no such column DestList'

Obs: in the line below (of TSQLVirtualTableCursorExternal.Search - mORMotDB.pas) ...

fStatement := fProperties.NewThreadSafeStatementPrepared(SQL,true);

'SQL' contains:

'select Codigo,Descricao,Departamento,DestList,DataCadastro,ID from Produto'

...and the table "Produto" don't have the field "DestList" (TSQLRecordMany).

Obs 2:
if I run the procedure "SQLite3ConsoleTests" (of mORMotSelfTests.pas) its works ok.

Board footer

Powered by FluxBB