Added to ZDbcInterbase6.pas:
Code: Select all
Checks if a connection is still alive by doing a call to isc_database_info
It does not matter what info we request, we are not looking at it, as long
as it is something which should _always_ work if the connection is there.
We check if the error returned is one of the net_* errors described in the
firebird client documentation (335544721 .. 335544727).
Returns 0 if the connection is OK
Returns non zeor if the connection is not OK
function TZInterbase6Connection.PingServer: integer;
Buffer: array[0..IBBigLocalBufferLength - 1] of Char;
DatabaseInfoCommand := Char(isc_info_reads);
ErrorCode := FPlainDriver.isc_database_info(@FStatusVector, @FHandle, 1, @DatabaseInfoCommand,
if (ErrorCode >= 335544721) and (ErrorCode <= 335544727) then
result := -1
result := 0;