#1 2010-06-21 16:36:30

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

Sample Applications

There are 3 sample applications up to now supplied with the framework sources, which purpose is to:
- show In-Memory ORM;
- show SQLite3-based ORM;
- basic Client/Server ORM.


Sample 01 - In Memory ORM
     purpose of this sample is to show the basic ORM usage of the framework:
   - a TSampleRecord class is defined in Unit1.pas
   - a static server (i.e. in-memory database) is initialized (see TSQLRestServerStatic.Create); it will store the data in a JSON file in the disk and won't require the SQLite3 database engine
   - the purpose of the form in Unit1.pas is to add a record to thedatabase; the Time field is filled with the current date and time
   - the 'Find a previous message' button show how to perform a basic query
   - on application quit, the Database.Destroy will update the JSON file
   - since the framework use UTF-8 encoding, we use some basic functions for fast conversion to/from the User Interface; in real applications, you should better use our SQLite3i18n unit and the corresponding TLanguageFile.StringToUTF8() and TLanguageFile.UTF8ToString() methods
   - note the tiny size of the EXE (since we don't use SQLite3), less than 80KB with LVCL

Sample 02 - Embedded SQLite3 ORM
     purpose of this sample is to show embedded SQLite3 database usage:
   - a TSampleRecord class is defined in Unit1.pas
   - a SQLite3 server is initialized (see TSQLRestServerDB.Create below) and will work embedded, i.e. not in Client/Server mode here
   - the CreateMissingTables method will create all necessary tables in the SQLite3 database
   - the purpose of the form in Unit1.pas is to add a record to the database; the Time field is filled with the current date and time
   - the 'Find a previous message' button show how to perform a basic query
   - since the framework use UTF-8 encoding, we use some basic functions for fast conversion to/from the User Interface; in real applications, you should better use our SQLite3i18n unit and the corresponding TLanguageFile.StringToUTF8() and TLanguageFile.UTF8ToString() methods
   - note that you didn't need to write any SQL statement, only define a class and call some methods; even the query was made very easy (just an obvious WHERE clause to write)
   - thanks to the true object oriented modeling of the framework, the same exact Unit1 is used for both static in-memory database engine, or with SQLite3 database storage: only the TForm1.Database object creation instance was modified
   - look at the tiny size of the EXE (even with SQLite3 engine embedded), less than 400KB with LVCL

Sample 03 - NamedPipe Client-Server
     purpose of this sample is to show Client/Server SQLite3 database usage:
   - a TSampleRecord class is defined in Unit1.pas
   - this sample uses down projects, Project03Client.dpr and Project03Server.dpr
   - a SQLite3 server is initialized in Project03Server
   - the CreateMissingTables method will create all necessary tables in the SQLite3 database
   - one or more client instances can be run in Project03Client
   - the purpose of the Client form in Unit1.pas is to add a record to the database; the Time field is filled with the current date and time
   - the 'Find a previous message' button show how to perform a basic query
   - since the framework use UTF-8 encoding, we use some basic functions for fast conversion to/from the User Interface; in real applications, you should better use our SQLite3i18n unit and the corresponding TLanguageFile.StringToUTF8() and TLanguageFile.UTF8ToString() methods
   - note that you didn't need to write any SQL statement, only define a class and call some methods; even the query was made very easy (just an obvious WHERE clause to write)
   - thanks to the true object oriented modeling of the framework, the same exact Unit1 is used for both static in-memory database engine, or with SQLite3 database storage: only the TForm1.Database object creation instance was modified
   - look at the tiny size of the EXE (even with SQLite3 engine embedded), less than 400KB for the server, and 80KB for the client, with LVCL...

smile

Offline

Board footer

Powered by FluxBB