How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
L_VV
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 30.03.2021, 18:42

How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

Post by L_VV »

Hello,

How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

Now the TZAbstractDbcConnection.PingServer function is called, which throws the EZUnsupportedException exception:

Code: Select all

Raise EZUnsupportedException.Create(SUnsupportedOperation);

Code: Select all

                                                          / TZInterbase6Connection - has overrided method PingServer: Integer; override;
TZAbstractDbcConnection <-- TZInterbaseFirebirdConnection
                                                          \ TZFirebirdConnection   - no PingServer method
  unit ZDbcConnection                                                          

  declared
  TZAbstractDbcConnection = class...
    function PingServer: Integer; virtual;
Or do I understand something wrong?
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 766
Joined: 18.11.2018, 17:37
Location: Hungary

Re: How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

Post by aehimself »

Hello,

Long story short: it not enough to add the overridden method.
- First of all, the database (and the driver) must support pinging; e.g. FreeTDS does not support it.
- If they do, the driver loader has to be modified to load the method for pinging
- At this stage we can override the connection's pingserver method and call the method in the driver we loaded earlier
- For this to work we must know the correct parameters and (maybe) make them available

It's possible that FireBird does support ping, just noone implemented it yet. If you happen to find the correct method to look for (preferably the driver's API help which shows the parameters too) and post it here, I can implement it for you.
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

Post by marsupilami »

Hmm - the ISC api doesn't support an explicit ping. What is done is to read the number of the overall reads on the current database since it was attached using isc_database_info. So the ping is faked in a way.
I am assume that a function similar to isc_database_info exists in the new interface based API, since the new API is meant to replace the ISC API. But I didn't take time do dig around in the documentation for that.
I suggest to turn this into a feature request and link it to this thread.
L_VV
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 30.03.2021, 18:42

Re: How difficult to add the PingServer method to TZFirebirdConnection, like in TZInterbase6Connection?

Post by L_VV »

Hello,

I temporarily implemented my own PingServer function through the request of the current time on the database server:

Code: Select all

select current_timestamp from rdb$database
It's not quite good, because a real query for the database is performed, instead of receiving a version of the server API, or something like that.

I created FR to implement a PingServer method for Firebird:
https://sourceforge.net/p/zeoslib/internaltickets/31/
Post Reply