#1 2014-03-17 13:00:26

Celso
Member
Registered: 2013-05-14
Posts: 55

Convert application clint-server Datasnap to mORMot

I have some crucial questions to convert my DataSnap project in ORM.

Today my application (client-server) already have a database where the application runs. Today use a DataSnap server.

My questions are:

1) To convert to mORMot I use the application accessing this external database with SQL (same as example 16) or should I switch to TSQRecord create and use virtual tables?

2) The database should remain as it is or would be interesting I change a field to store using JSON instead of having individual fields. example:
Today CREATE TABLE "CPU_COMPANY"
          ("CNPJCPF" VARCHAR (18) NOT NULL,
           "NAME" VARCHAR (60) NOT NULL,
           "FANTASY VARCHAR (60) NOT NULL,
           "INSC_EST VARCHAR (18),
           "INSC_MUN VARCHAR (18),
  PRIMARY KEY ("CNPJCPF")
);

tomorrow:
CREATE TABLE "CPU_COMPANY"
(
   "CNPJCPF" VARCHAR (18) NOT NULL,
   "COMPANY_DATA" SUB_TYPE BLOB TEXT SEGMENT SIZE 80 NOT NULL,
  PRIMARY KEY ("CNPJCPF")
);

Offline

#2 2014-03-19 16:16:53

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

Re: Convert application clint-server Datasnap to mORMot

1) If you can, using the ORM methods is pretty powerful, and will directly implemented with mORMot.
Ensure you took a look to the ExternalDB.MapField() method, which may help.
But the mORMot primary key is expected to be an integer, not some text.

As an alternative, you can use interface-based services, then put your custom SQL on the server side.
It will probably be very useful, and easy to maintain, and integrate with existing code.

2) Sounds like if you are guessing to move into a "schema-free" approach, here.
In this case, a RDBMS is not the best option.
A NoSQL engine, like MongoDB or Redis is worth considering.
We have start adding direct fast MongoDB connection with mORMot units - not yet finished, but it may be of some interrest for you.
If you need, we could finish and tune our SynMongoDB unit soon.

Offline

#3 2014-03-21 16:42:20

Celso
Member
Registered: 2013-05-14
Posts: 55

Re: Convert application clint-server Datasnap to mORMot

Thanks for the feedback.

I will use the ORM methods. About DB'll continue using RDBMS

Offline

Board footer

Powered by FluxBB