Page 1 of 1

Two critical new featues

Posted: 05.06.2013, 14:19
by cmatrix
I think Zeos 7 could benefit enormously by having two very important features.

1. An event that fires when the connection is lost. This is very important in unstable environments like wireless networks.

2. A timeout property for ZConnection. Now with certain DBs (like I'm seeing now with MS SQL on ADO) a Zeos app will hang indefinitely if the connection parameters are invalid. I understand this can be mitigated on certain DBs like My SQL by changing certain properties. But it would be extremely convenient for Zeos to handled this internally.

Posted: 06.06.2013, 13:13
by EgonHugeist
cmatrix,

Theire is a way to determine ConnectionLost for MySQL and Oracle(\testing 7.1 (SVN)):

Code: Select all

if TZConnection.DbcConnection.PingServer = 0 then
  //Success
else
  //disconnected
...
Timeout can be settet too defaults of MySQL:
http://stackoverflow.com/questions/2436 ... n-in-mysql

But you can use

Code: Select all

TZConnection.Properties.Values['timeout'] := '60';

too. See ZDbcMySQL.pas:

Code: Select all

...
    ConnectTimeout := StrToIntDef(Info.Values['timeout'], 0);
    if ConnectTimeout >= 0 then
      GetPlainDriver.SetOptions(FHandle, MYSQL_OPT_CONNECT_TIMEOUT, PAnsiChar(@ConnectTimeout));
...
Is this answer sufficient?

Posted: 06.06.2013, 14:01
by cmatrix
Pinging the DB server before every data access is very inconvenient. I think an OnLostConnection event would be very useful.

In my experience setting the timeout in .Properties has never worked (in MySQL anyway). I'll try looking into that further.

Posted: 08.06.2013, 20:05
by EgonHugeist
cmatrix,
Pinging the DB server before every data access is very inconvenient. I think an OnLostConnection event would be very useful.
Yes i know Pinging allways is inconvenient. I was thinking about an Improvement with a TThread which can do the job..
In my experience setting the timeout in .Properties has never worked (in MySQL anyway). I'll try looking into that further.
Well i've no idea if it works. Please test it. Again: The MySQL defaults are 2700 secs. If you're more patiant (; little joke...


Any proposals for such an event?