#1 Re: mORMot 1 » mORMot ORM questions » 2013-11-19 15:11:55

Hey, thanks for the fast answer. I think i wasn't clear enough as seeing your answer.
I am reading the 1.18 SAD documentation, but I can't understand how to tell the RestClient to use my connection properties?
Gluing of all the parts is the current problem in front of me ><

Can you point me to a page where I can see sample constructions.

Best Regards,
Daniel Tsviatkov

#2 mORMot 1 » mORMot ORM questions » 2013-11-19 14:50:59

daniel.tsviatkov
Replies: 3

Greetings,

I am trying to figure out how the ORM part of the framework is working, but no luck until now, so I decided to give it a try here.
Lets say I have a "model" which should reflect a row in the table "city" of the database.

City = class(TSQLRecord)

And some DB connection properties (in my case ZEOS)

Properties := TSQLDBZEOSConnectionProperties.Create(/*connection string*/);

How I can:
# retrieve in local variable of type City the record with ID 1
# retrieve in local variable of type City the record with name = 'new york'
# retrieve in local variable of type Array[City] where ID between 10 and 15

And lets assume we have a BELONGS_TO relation to another "model" country via country_id FK:
How I can:
# retrieve in local variable of type Array[City] where country.name = 'us';
# eager load in load variable of type Array[City] with their corresponding Country "models"
# create new record in "country" table with 2 related records in "city" table at once. (not single insert, but for example in other framework of another language i would use countryModel.Save( with related );

Thanks in advance!
Best Regards,
Daniel Tsviatkov

Board footer

Powered by FluxBB