#1 2017-05-31 06:47:59

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

MormotSqlite3.MainEngineList doesn't rise exception

Hi AB,

in line 1337 of unit in subject there are these istructions .

      except
        on E: ESQLite3Exception do
          GetAndPrepareStatementRelease(E);
      end;

createandfillprepare , in case of exception, returns a null resultset without any advertisement.
This means that i have , every time , to check for tSqlRsetServerDB.StatementLastException to be sure that all worked fine ?
Now i'm only catching  exceptions.

Offline

#2 2017-05-31 06:57:08

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

Re: MormotSqlite3.MainEngineList doesn't rise exception

By design, exceptions can't be propagated over a network.
Since all this DB process may be run remotely, the exceptions are catch on server side.

So yes, you have to check for a null result set, as documented.
A valid request, returning no result row, will never be null - but only with column names.

Offline

#3 2017-05-31 07:12:00

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: MormotSqlite3.MainEngineList doesn't rise exception

Tx AB.

Offline

#4 2017-05-31 07:14:33

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: MormotSqlite3.MainEngineList doesn't rise exception

Anhoter question please :

on server side , what object, instead of tMySQLRestServerDB, I should better use to access data by ORM?

Offline

#5 2017-05-31 07:44:51

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

Re: MormotSqlite3.MainEngineList doesn't rise exception

If you can, you may just define and inject a TSQLRest instance dependency on server side.

Offline

#6 2017-05-31 08:20:09

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: MormotSqlite3.MainEngineList doesn't rise exception

Well,

one thing i have clear , i am totally confused and thick as a brick !!

Sorry to annoying you with newby questions, but i'm trying to put order in my mind :

- a tSQLRestServerDb runs only on server side.
- I'm using a tSQLClientRestURI to run processes from remote.
- so , why a tSQLRestServerDB.CreateAndFillPrepare  doesn't return an exception ?

Offline

#7 2017-05-31 08:35:14

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

Re: MormotSqlite3.MainEngineList doesn't rise exception

Because ORM methods do implement the Liskov substitution principle, so they follow abstract TSQLRest expectations, which may be a client or server implementation.

If the server does not behave the same as the client (i.e. raise an exception whereas the client won't), then the Liskov principle is broken.

Offline

#8 2017-05-31 11:02:19

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: MormotSqlite3.MainEngineList doesn't rise exception

Sounds a very good reason.

I have added a control of StatementLastException after the createandfillprepare nested in transaction : now seems to work ok.

tx very much AB.

Offline

Board footer

Powered by FluxBB