#1 2010-07-31 18:20:35

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

SQLite3 MainDemo source code uploaded to the repository

The SQLite3 MainDemo source code has just been uploaded to the repository

- also the SQLite3 framework has been updated this week, in order to provide easier UI integration
- still in draft, but working and compiling under both Delphi 7 and Delphi 2010

See the source code in http://synopse.info/fossil/dir?name=SQL … s/MainDemo

You'll notice that all is done in code (no RAD/IDE approach here), but with very little code lines count...

An executable (still in draft status) can be downloaded from http://synopse.info/files/samples/synfile.zip

Offline

#2 2010-08-03 22:31:07

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

Re: SQLite3 MainDemo source code uploaded to the repository

This application is just a database tool which stores text content and files into the database, in both clear and safe manner. Safe records are stored using AES-256/SHA-256 encryption.
There is an Audit Trail table for tracking the record changes.

We used TMS components for the User ribbon interface. They are not so well written (from the code point of view: TMS source has a lot of code duplication, and don't use RTTI as it should) but they do work well, and the final result on screen is very good, which was the key point for our customer.
The ribbon component shipped with Delphi 2009 was buggy, and our managers didn't want to go to this compiler version with a sensitive application like the one we were working for (a medical application). Delphi 7 was just fine for our projects, since our framework is natively UTF-8, so unicode ready, even on Delphi 7.
The ribbon in Delphi 2010 seems smooth enough to be used in production. It could be used instead.
In all cases, I want to make the option of using pure Delphi components for creating the user interface. But for a first main demo, you can even use the trail version of the TMS components to compile the sources.

Offline

#3 2010-08-03 22:43:39

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

Re: SQLite3 MainDemo source code uploaded to the repository

Here is how this demo works.

Database Model
First, the database tables are defined with regular Delphi classes, like a true ORM framework. Classes are translated to database tables. Published properties of these classes are translated to table fields. Nice and easy.
See http://synopse.info/fossil/artifact/bf6 … e852e0326f unit.
This unit is share by both client and server sides, with a shared data model, i.e. a TSQLModel class instance, describing all ORM tables/classes.
It contains also internal event descriptions, and actions, which will be used to describe the software UI.

Business Logic
Then the server side is just another class, which implements an automated Audit Trail, and a service named "Event" to easily populate the Audit Trail from the Client side.
See http://synopse.info/fossil/artifact/f88 … 1f7267ea68

The client side is another class, which is able to communicate with the server, and fill/update/delete/add the database content playing with classes instances. It's also used to call the Audit Trail related service, and create the reports.
See http://synopse.info/fossil/artifact/2f8 … 325de038cb
You'll see that BLOB fields are handled just like other fields, even if they use their own RESTful GET/PUT dedicated URL (they are not JSON encoded, but transmitted as raw data, to save bandwidth and maintain the RESTful model). The framework handles it for you, thanks to its ORM orientation, and the ForceBlobTransfert := true line in TFileClient.Create method.

Presentation
The main form of the Client is void, if you open its dfm file. All the User Interface is created by the framework, dynamically from the database model and some const values and enumeration types (thanks to Delphi RTTI) defined in FileTables unit (the first one, which defines also the classes/tables).
It's main method is TMainForm.ActionClick, which will handle the actions, triggered when a button is pressed.
See http://synopse.info/fossil/artifact/e7c … 1de450bc15
The reports use GDI+ for anti-aliased drawing, can be zoomed and saved as pdf or text files.

The last unit is just the form used for editing the data. It also performs the encryption of "safe memo" and "safe data" records, using our SynCrypto unit.
You'll discover how the ORM plays its role here: you change the data, just like changing any class instance properties.
See http://synopse.info/fossil/artifact/503 … 2214b396fa
It also use our SynGdiPlus unit to create thumbnails of any picture (emf+jpg+tif+gif+bmp) of data inserted in the database, and add a blob data field containing these thumbnails.

This demo has been compiled with Delphi 7, but you can recompile it with Delphi 2009/2010, and get all Unicode related benefits if you want.

Offline

#4 2011-11-04 09:36:55

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

Re: SQLite3 MainDemo source code uploaded to the repository

As stated above, the User Interface part of our SQLite3 framework was using proprietary components from TMS software.
See http://www.tmssoftware.com

It can now generate a Ribbon interface using plain VCL components.
synfilescreenvcl.png

See http://synopse.info/forum/viewtopic.php?id=280

Offline

#5 2012-02-07 23:38:08

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

Re: SQLite3 MainDemo source code uploaded to the repository

Is it possible to use this idea in a multi-machine idea.
i.e. to have a commeon database for any user of synFile.
if so can any machine be notified of changes to the memo's sent etc.

Tom

Offline

#6 2012-02-08 07:11:00

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

Re: SQLite3 MainDemo source code uploaded to the repository

You can deploy the SynFile in a Client-Server mode, without any huge code change.

See the documentation about Client-Server, stand-alone, and remote access.
It already instantiate a HTTP server - you'll just have to use the client part without creating a new server instance.

Offline

#7 2012-07-13 03:28:16

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: SQLite3 MainDemo source code uploaded to the repository

How to read customs Field from TSQLRibbonTabParameters?

TFileRibbonTabParameters = object(TSQLRibbonTabParameters)
  /// the SynFile actions
  Actions: TFileActions;
  Test1: string;
  ..
end;

...
var
  T: TFileRibbonTabParameters;
  Test: string;
begin
  T:= Ribbon.GetParameter(TSQLSomeRecord)^;
  Test:= T.Test1;
  ...
end;

is it possible to Save and load TSQLRibbonTabParameters to file on-the-fly?

thanks

Offline

#8 2012-07-13 05:07:29

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

Re: SQLite3 MainDemo source code uploaded to the repository

You can just use a pointer typecast:

TFileRibbonTabParameters = object(TSQLRibbonTabParameters)
  /// the SynFile actions
  Actions: TFileActions;
  Test1: string;
  ..
end;

...
var
  T: ^TFileRibbonTabParameters;
  Test: string;
begin
  T:= Ribbon.GetParameter(TSQLSomeRecord);
  Test:= T^.Test1; // or just Test := T.Test1;
  ...
end;

You can safe a record content using RecordLoad and RecordSave, as supplied by SynCommons.pas.

Offline

#9 2012-07-13 05:18:07

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: SQLite3 MainDemo source code uploaded to the repository

ok, thank you. i'll try it.

Offline

#10 2012-07-13 05:52:04

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: SQLite3 MainDemo source code uploaded to the repository

Hallo ab, i tried create a unit to handle TSQLRecord and TSQLRecordMany published property. Just Inpired by TDBNavigatorButton from DB.pas unit.
i need some suggestion, the unit contain aroun 1200 lines of code. i want to share with the others even not so good code.
can i post here? or can i send to your email please?

Offline

#11 2012-07-13 09:13:46

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: SQLite3 MainDemo source code uploaded to the repository

hallo ab, i cannot compile this code:

..
RTP: ^TFileRibbonTabParameters;
..

RTP:= fRibbon.GetParameter(RC);

//[Error] BPBaseEdit.pas(380): Incompatible types: 'TSQLRibbonTabParameters' and 'TFileRibbonTabParameters'

i also try this code

RTP:= TFileRibbonTabParameters(fRibbon.GetParameter(RC));
or
RTP^:= TFileRibbonTabParameters(fRibbon.GetParameter(RC));
or
RTP:= TFileRibbonTabParameters(fRibbon.GetParameter(RC)^);

//with compiler error: Invalid typecast


what i'm doing wrong? I don't know much about pointer.
thank you

Offline

#12 2012-07-13 09:23:55

coblongpamor
Member
From: Bali-Indonesia
Registered: 2010-11-07
Posts: 130
Website

Re: SQLite3 MainDemo source code uploaded to the repository

finally.., after all day trying..

RTP:= Pointer(fRibbon.GetParameter(RC));

thank you..

Offline

Board footer

Powered by FluxBB