#1 2012-03-16 00:23:08

Tom Duncan
Member
Registered: 2012-02-07
Posts: 49

Is it possible to use the Json part of mORMot with an external Query

Hi All,
I am using a Tquery and I need to use Json to send/receive data.
Can the Json part be used for this query.
Tom

Offline

#2 2012-03-16 08:26:53

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

Re: Is it possible to use the Json part of mORMot with an external Query

If you use the SynDB wrapper of TQuery, you are able to serve JSON content from a TQuery statement.

There is already such a sample in directory "SQLite3/Samples/13 - StandAlone JSON SQL server".

This "13 - StandAlone JSON SQL server" sample's aim is to directly
    serve SQLite3 JSON results from SQL using HTTP server.

  It will expect the incoming SQL statement to be POSTED as HTTP body, which
  will be executed and returned as JSON.

  This default implementation will just serve the Test.db3 file as generated
  by our regression tests.

  But it is a very rough mechanism:
  - No security is included;
  - You can make your process run out of memory if the request returns too much rows;
  - All incoming inputs will not be checked;
  - No statement cache is used;
  - No test was performed;

  Therefore, this method is much less efficient than the one implemented by mORMot.
  This is just a rough sample - do not use it in production - you shall better
  use the mORMot framework instead.

  Using SynDB classes instead of directly SynSQLite3 will allow to use any other DB,
  not only SQlite3.

  see http://synopse.info/forum/viewtopic.php?id=607 for the initial request

See this sample in http://synopse.info/fossil/dir?name=SQL … SQL+server

You can of course your own TQuery, then write some code similar of the one implemented in SynDB.pas unit.
So yes, the answer is that the JSON part can be used for this query.

Offline

Board footer

Powered by FluxBB