#1 2016-07-04 11:15:03

Peter Evans
Member
Registered: 2016-07-03
Posts: 32

DataSnap with a main database - moving to Interfaces

My understanding is probably lacking in some areas.

I copied methods from my DataSnap program, and, rewrote them as methods using Interfaces.

I then realized that some of the methods have calls to SQL queries etc. They are against
the database ElevateDB from Elevate Software. (Aside - Apparantly there is an ODBC driver available from Elevate Software.) There is only one main database.

In Project 14 there is the TServiceCalculator with function Add. That function doesn't call
a database.

In DataSnap there is a form :-

   TServerMethods1 = class(TDSServerModule)

On the form I have components for :-
  Session, Database, Tables, Queries etc.

Here is an example of an existing DataSnap method converted to mORMot.
It does SQL queries within the method :-

  TLogoffAdmin = class(TInterfacedObject, ILogoffAdmin)
  public
    function LogoffAdmin(const Company1     : String;
                         const Name1        : String;
                         const Area1        : Integer;
                         const MemObj       : TMemObj;
                         var   iLastAutoInc : Integer) : Boolean;
  end;

What sample do you think I need to look at so that methods accessing the main database
can be successfully called?

Regards,
  Peter Evans

Offline

#2 2016-07-04 11:48:34

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

Re: DataSnap with a main database - moving to Interfaces

The easiest is to use a sicShared kind of interface implementation, then create a shared DB connection within the instance.
But you would have to secure the multi-threaded access to the DB connection.
An alternative may be to use sicPerThread and one DB connection per thread.$

Please check the doc about interfaces.
See http://synopse.info/files/html/Synopse% … ml#TITL_92
and also http://synopse.info/files/html/Synopse% … ml#TITL_72

Offline

#3 2016-07-04 23:04:45

Peter Evans
Member
Registered: 2016-07-03
Posts: 32

Re: DataSnap with a main database - moving to Interfaces

Thank you. I will look into those now.

Offline

Board footer

Powered by FluxBB