You are not logged in.
Hi,
I am new to MORMOT and understand that extending the TSQLRecord class one can build a class in Pascal code which can then automate database table design and creation, JSON transport and much more. This is very powerful.
But I already have a Firebird 3 database schema with 34 tables which already defines my domain information structure very well.
I need now to make Pascal classes which replicate this same database structure, and connect to and from the database, and then also allow JSON transport for a client - server multi-tier product.
As I already have the database structure designed, is it possible in MORMOT to read this Firebird database schema and then automatically create the Pascal classes, presumably using TSQLRecord? This seems to be the reverse of the automation of the database from the Pascal classes usually done in MORMOT.
Please advise
Thanks
Martin
Last edited by msgendodoc@gmail.com (2020-02-12 11:11:42)
Offline
IIRC there's no automatic procedure to do this task. But IMHO it's not much work to do with 34 tables->classes and you can adapt, map, improve, etc... some classes to fit ORM. It was for me a good point to read first ORM is not Database
Offline
Thanks for the link. OK, so DB to Pascal class is not the done thing. Focus on the classes, you say. Shame as my DB Schema really reflects my domain and work flow.
I did already write a Pascal procedure to iterate each field in each database table and automatically generate the Pascal code for a class for each table. And I thought that was pretty neat, when it worked and compiled too!!
So I might still use that procedure to create class templates from the database tables and then further work on the automatically generated code to make the classes mORMot compatible.
Offline
SynDB Explorer (in folder SQLite3\Samples) generates the class code for you.
Take a look.
Offline