#1 2012-09-25 08:26:58

yifaa
Member
Registered: 2012-09-24
Posts: 4

mORmot Framework is very good, but I don't know how to start quickly

Dear ab:

At first I will give you a big thank for your great mORMot Framework!
As a beginner of the framework,I don't know how to start...
There are so lots of classes and methods and functions and procedures.......
I study the samples but I can't make myself clear.

for examples:
I want to do some works in Sample 2(project02.dpr):

1. Update the record which Name='ab', set the field Question value as 'ab is a good man.'  (^0^),
    Like in SQL:
    update SampleRecord set Name=ab',Question='ab is a good man.' where Name='ab'

2. Get data in the SampleRecord dataable and fill the return data into a grid.
    Like in SQL:
      Get all fields by condition:  select * from SampleRecord Where ID>5 and Name like 'ab%'
      Get special fields by condition:  select ID,Name from SampleRecord Where ID>5
   
3. how to add another DataTable into the project02.db3 database?

if  you make a step to step tutorial for us, I think the mORmot will be easier.(^0^)

so many questions,sorry!

Last edited by yifaa (2012-09-25 15:52:30)

Offline

#2 2012-09-25 10:03:49

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

Re: mORmot Framework is very good, but I don't know how to start quickly

1. Such an update without any where clause is a bit "strong", for a real application.

In most applications, if you want to be RESTful, you first get a list of IDs and other needed columns via a FillPrepare(), then retrieve and update each record - better within a BATCH, which will allow update only of the values from the FillPrepare.

If you want a direct set, you can use the EngineUpdateField() method on the client side, or even better, a dedicated service on the server side, running the request.
Direct SQL statements can be executed on the server side, but if you want all internal events to be triggered, EngineUpdateField() is more complete.

But once again, the RESTful / ORM way is to use FillPrepare + Batch update.

2. Use FillPrepare then SQLite3UI to fill a grid.

3. Add a TSQLRecord sub-class to the TSQLModel instance of your client-server architecture.
The framework will create and add the new table in the existing database.

PS:

You are right: such cases should be detailed in simple terms in the documentation.

Offline

#3 2012-09-26 01:15:36

yifaa
Member
Registered: 2012-09-24
Posts: 4

Re: mORmot Framework is very good, but I don't know how to start quickly

Thanks ab's good suggestions,you are so kind!
I'm glad to have a try to the above problems.
I'll work hard to learn the framework till master her. (ha..... I think the mORmot is a beautiful girl who feel good but hard to be close).

Last edited by yifaa (2012-09-26 01:16:58)

Offline

#4 2012-09-26 04:33:49

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

Re: mORmot Framework is very good, but I don't know how to start quickly

Is mORMot a she?

Why not indeed!
smile

Offline

Board footer

Powered by FluxBB