#1 2013-05-21 18:44:57

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

uniGUI with mORMot

Hi there, I did a MacGyver repair to get the uniGUI working with mORMot. Here, uniGUI is the web application and mORMot is the server data, it uses a local SQLite database. In my experiment, I can make changes in a DBGrid and update remotely using batching sequences in client side to write back to the database. I'm using TSQLTableToDataSet to convert a TSQLTable result into a TDataSet and assign it to a TDataSetProvider.

Click here to watch my 5-minute video
http://youtu.be/LCLiorJYgZw

In my experiment, it was possible to use SQLite3 as a client-server where the same database will be accessed simultaneously by many clients/threads, accessing a common database. 

I was wondering how can I access an sqlite database that is sitting a remote server (like example 16), I didn't find out a way to connect a Sqlite from a remote hosts with a port number.

Offline

#2 2013-05-22 06:00:11

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

Re: uniGUI with mORMot

Yes, some kind of weird to use a TDataSet for binding UniGUI.
smile

SQlite3 data file can be used locally from several processes. With the expense of some performance issues.

SQLite3 is a LOCAL database: there is no transmission layer.
(this is where mORMot is great, since it adds secure and fast remote access to SQLite3 with a RESTful JSON API)

But you should never use SQLite3 file remotely, via a network folder.
http://www.sqlite.org/lockingv3.html#how_to_corrupt

Offline

#3 2013-05-22 11:02:17

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: uniGUI with mORMot

So if I have mORMot running as an HTTP server is it perfectly ok to have a separate utility program to manage user accounts which accesses the same local SQlite3 data file directly? This seems a simpler and more secure way of managing user accounts than using services.

Offline

#4 2013-05-22 13:25:12

Junior/RO
Member
Registered: 2011-05-13
Posts: 210

Re: uniGUI with mORMot

@Warley

you are using a local SQLite with mORMot, right? when I use mORMot with unigui, I use TSQLRestClientDB.

Offline

#5 2013-05-22 16:56:14

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

Re: uniGUI with mORMot

esmondb wrote:

So if I have mORMot running as an HTTP server is it perfectly ok to have a separate utility program to manage user accounts which accesses the same local SQlite3 data file directly? This seems a simpler and more secure way of managing user accounts than using services.

Yes.

But I'm still convinced a dedicated UI is more convenient (e.g. to manage group rights).
And/or use Windows authentication.

Offline

#6 2013-05-23 01:58:47

warleyalex
Member
From: Sete Lagoas-MG, Brasil
Registered: 2013-01-20
Posts: 250

Re: uniGUI with mORMot

Yep, this is like bizarre creatures from another planet.

For those who have not seen the video, typically in uniGUI, if you want to show records from your database table on a DBGrid in your application, you will need:

1- TSQLConnection to provide the necessary connection details to the database.  One TSQLConnection can service several TSQLDatasets.

2- A TSQLDataset component which will specify the TSQLConnection component in the SQLConnection property. 

3- A TDatasetProvider component which will specify the TSQLDataset in its Dataset property.

4- A TClientDataset component which will specify the TDatasetProvider in its ProviderName property

5- A TDataSource component which will specify the TClientDataset component in its Dataset property.

A TDBGrid component which will specify the TDataSource in its DataSource property.

By setting the appropriate Active properties to true in TSQLConnection, TSQLDataset and TClientDataset you should find that the data will appear in the grid.
_______________
I skipped steps 1-2 to simply display data in a DBGrid, for me, the easiest way to edit/delete/insert any of the cell values in a DBGrid with mORMOt and write back do database is using TClientDataSet. On BeforeApplyUpdates event I could capture delta, and put Delta back to to the database using Batch sequences. TDatasetProvider here is like a pipe connecting TClientDataset with TSQLTableJSON. It seems like quite a bit of effort to simply display and modify records in a DBGrid, but that is the way it works!

Offline

#7 2013-09-09 08:47:03

chikh
Member
Registered: 2013-09-07
Posts: 2

Re: uniGUI with mORMot

hi warleyalex, I am interesting and "exciting" to use Unigui with Mormot

Can you upload the example that you show in your Video , or other examples

Thanks a lot

Offline

Board footer

Powered by FluxBB