#1 2013-12-25 11:01:40

martin.suer
Member
Registered: 2013-12-15
Posts: 76

Zeos 7.2 with Firebird 2.5.2 on external server

Hi,

the answer to my question about UniDAC with external Firebird with the performance comparison to zeos made me curious. So I downloaded the zeos trunc and began experimenting...

I now have zeos 7.2 trunc running with mormot. It generally works but I ran into two issues:

1) is the same I ran into using UniDAC: The momrot code is assuming one uses the embedded Firebird (there's no way to pass a ServerName to the URI function). I can setup a connection to an external Firebird db using this code:

aProps := TSQLDBZeosConnectionProperties.Create(
    TSQLDBZEOSConnectionProperties.URI(dFirebird),
    'mormot', 'SYSDBA', 'masterkey');
  TSQLDBZeosConnectionProperties(aProps).ZeosURL.HostName := '10.211.55.2';
  TSQLDBZeosConnectionProperties(aProps).ZeosURL.LibLocation :=
    'C:\works\Firebird-2.5.2.26540-0_Win32\bin\fbclient.dll';
  TSQLDBZeosConnectionProperties(aProps).ZeosURL.Properties
    .Values['createNewDatabase'] := '';

This works but one has to change the ZeosURL manually after creating the ConnectionProperties. Also the TSQLDBZeosConnectionProperties.Create is setting the createNewDatabase because it tries to find the database (which in my case is on a different server) on the local servers file system. If I don't reset that value, zeos tries to delete my existing db on the external server...

2) Using the mORMot Sample Project 02 (modified to use Firebird with   VirtualTableExternalRegister(Form1.Model,TSQLSampleRecord,aProps,'SampleRecord') ) there's a problem with setting the entered Values in the form to the query parameters.
I have changed the TSQLSampleRecord and renamed the Time property because that's a firebird reserved word. With that and the above setup code for the zeos connection the Sample Project02 creates a SAMPLERECORD Table in the firebird db with 2 blob fields (because the corresponding two properties in the TSQLSampleRecord have no index clause). When I enter values to the form and press the 'Add the message' button, a new record is saved to the db but the 2 fields for NAME and MESSAGE are empty.
Is this an expected behaviour?
Changing the code of the sample to use UniDAC instead of zeos, writing the NAME and MESSAGE fields to the blob fields is working. So at least the behaviour is different.
Modifying the TSQLSampleRecord definition by adding index clauses to the RawUTF8 properties, zeos creates the Table like expected with the corresponding varchar db fields with the expected length and then the Sample Project02 is working correctly also with zeos.
Of course, I wouldn't omit the index clause in real life projects but am wondering if there may be a general problem with setting blob values using mORMot, with zeos and firebird and wanted to let you know.

Martin

Offline

#2 2013-12-25 13:37:32

wai-kit
Member
From: Amsterdam, the Netherlands
Registered: 2012-11-27
Posts: 90

Re: Zeos 7.2 with Firebird 2.5.2 on external server

The same question has been on my mind, concerning access to a remote MySQL server using TSQLDBZeosConnectionProperties.


fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...

Offline

#3 2013-12-29 14:23:30

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

Re: Zeos 7.2 with Firebird 2.5.2 on external server

1) We have just added optional server name parameter to class function TSQLDBZEOSConnectionProperties.URI().
See http://synopse.info/fossil/info/2bf05d6a73
And the unit will also check for any Firebird hostname: if any is supplied (meaning this is not Firebird embedded), it won't create the database file.

2) By default, all BLOB fields are NOT sent to the server.
This is to preserve bandwidth.
So you need to set TSQLRestClientURI.ForceBlobTransfert property which enable to get and set BLOB fields values with usual Add/Update/Retrieve methods.
Or explicitly call TSQLRestClientURI.RetrieveBlobFields/UpdateBlobFields methods for retrieving/updating all BLOB fields of a record at once.
For such an external table, you should better define some field size in TSQLSampleRecord (via index 50 e.g.), and it will work as expected.

Offline

Board footer

Powered by FluxBB