#1 2012-02-15 05:30:28

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

General application design

Hi All,
I am going to use mORMot for my design of a Patient database.
It is a new version of one that I have designed.
With my progran now I use a database and db aware components etc.

What is the general way of using mORMot?
My thoughts are still use the database structure and create say a single record.
Then after that record is posted then send an Update to the server.
Patients names in a grid would come via a select Name from Payient etc.

Is this the easiest way of doing things.
Sorry but I am new to non database aware routines.

Tom

Offline

#2 2012-02-15 07:40:04

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

Re: General application design

Thanks for your interest.

Did you download the mORMot documentation?
See http://synopse.info/fossil/wiki?name=Downloads

The SAD document will tell you most of the concepts and application design patterns to be used.
Especially the "Think ORM" presentation, to find out how you can rely on the DB, without being stuck on it.

Offline

#3 2019-12-19 15:34:34

SFkaier
Member
Registered: 2019-12-19
Posts: 2

Re: General application design

This is my first post here and I'm sorry, I don't know where to post it, so i put it here as reply because i think that is the same subject.

I developed a small ERP for an industrial company a long time ago, everything was at the top until the arrival of win64 (windows 7 and 10 64bit), the computer park of the company is diversified, from win xp 32 to win10 64bit of course ... then it starts the bugs, my little software starts to crash especially in PCs equipped with win7 64bit and win10 and the message is the same each time "no connection with the database ... ", my little software was developed on Delphi2009 with the FIBPlus components for transactions with the database (FireBird V2.5). Of course I check the local network at each software crash with ping (cmd of windows ...) ... everything seems normal.
looking on the internet, I found that I have to put the DLL fbclient version 64bit in 64bit machines and 32 in 32 machines .... despite the crash persist .... a friend advised me to put the DLL fbClient 32bit in the directory (Windows \ syswow64 \) and the version 64 of the DLL in system32 directory , I know it doesn't make sense but since I'm looking for a solution I tried it and always the same crash ....
internet another time and here I find morMot and the whole concept of HTTP and REST servers and DATAsnap ... I got lost, me who used  DataSet abd DataSource, I find it difficult to understand all this circus, especially that 'there is no a single tutorial, for morMot + firebird... also in the example that come with morMot I still see the DLL file fbClient nicknamed fbEmbed, then I suppose that the same games of 64 and 32 will be repeated.
I write for the first time here, I want to find advice for two things ...
- What type of server should I develop and with what tool (framework)? (I have to keep Delphi2009 and my FireBird 2.5 database).
- Will the problem of 32bit and 64bit persist when switching to this new architecture and new server?
Thanks

Last edited by SFkaier (2019-12-19 15:43:45)

Offline

#4 2019-12-20 06:00:22

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: General application design

> - What type of server should I develop and with what tool (framework)? (I have to keep Delphi2009 and my FireBird 2.5 database).

You basically just need it to send DB data from server to client and updates from client to server? You can skip whole ORM architecture and just use method or interface based service to communicate between server and client. On server side you can use TSQLRestServerFullMemory as an ancestor class (read about it in docs and try few available samples).
Your server can send records in json format and your client can transform that to standard TDataset (so you'll have minimal changes), for changes to DB it's best that you send raw data to server and let the server perform update/insert commands to DB.

> - Will the problem of 32bit and 64bit persist when switching to this new architecture and new server?

You'll need just one fbclient dll and that's on the server (where FB server is), you won't need it on clients.

Offline

#5 2019-12-22 14:34:15

SFkaier
Member
Registered: 2019-12-19
Posts: 2

Re: General application design

thanks a lot igors233 for your reply,
so if i understand you well, i must do my business model (for that i can use the project 12- syndb explorer in the sample's dirctary)
and put it in unit that will be shared by the server side and client side, put all the CRUD operations in the client side.
my problem is how i instance the dataset? i mean that my project use DB components (FIBPlus)
all over the units of the project, so should i instance all the datasets or a simple unite where i instance the database
and the connection to it, and i leave all the rest without changement?
unfortunlly there is no example in all the documentation of morMot. in the documentation,
there is a simply note about the possibility to use TSQLRestServerFullMemory and the mentioned sample (14- interface based services)
is as his name indicate a simple service where no use of data base.

Offline

#6 2019-12-22 21:20:26

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: General application design

You don't need a whole business model (ORM part), you can completely skip that. Since you already have existing DB and basically you only need data, just use mORMot for data retrival (to eliminate FB clients on each computer). For that SynDB is one option, in that case you pass SQL queries from client to app on server which then takes it from FB db and sends data back. Another variant (with more work) is to create endpoints (interface or methods) for each data request you need. For example create interface with function named GetInvoices which prepares SQL query, sends it to db and sends results back. So in first variant, you control and stores everything on client and in second approach you control SQL queries (business logic) on server side.

> my problem is how i instance the dataset? i mean that my project use DB components (FIBPlus)
> all over the units of the project, so should i instance all the datasets or a simple unite where i instance
> the database and the connection to it, and i leave all the rest without changement?

Yes, that might be the problem and you would need to change that area. If FIBPlus datasets you're using allows to insert records to it, then you can retrieve those records through mORMot. fill FIBPlus dataset and let it show data in DBGrid. If that's not possible you would have to change datasets, to for example TClientDataset (to fill it you can use JSONToClientDataSet function) or to TSynDBDataSet (see sample 17).

Offline

Board footer

Powered by FluxBB