Subject Version 5.7.7 [Build 2340], Delphi 10 Seattle win32
Author Gerhard Knapp
Hello,
i used before an older IBO Version and had no problems with the function below.
Now i use the newest version on Delphi 10 Seattle and IBO and i get from time to time:

2015-11-20 10:54:45.193; *-*FBPOOL_ERROR_ONChecking2:Listenindex außerhalb des gültigen Bereichs (1)

If this CheckDBConnection = nil i then drop all Connnections.

Does someone see, whats wrong or have an idea what i could make better?

best regards
Gerhard


function TDBPOOL.CheckDBConn(conn :TIB_Connection):TIB_Connection;
var
  q    :TIB_Cursor;
begin
  result:= conn;
  CS.Acquire;
  try
    if conn <> nil then begin
      try
        try
          q:= TIB_Cursor.create(nil);
          q.Ib_connection:= conn;
          q.IB_Transaction:= conn.DefaultTransaction;
          q.sql.add('select current_timestamp from rdb$database');
          q.prepare;
          try
            q.first;
          except
            on e:exception do begin
              xlog('*-*FBPOOL_ERROR_ONChecking:' + e.message);
              q.IB_Transaction.rollback;
              result:= nil;
              exit;
            end;
          end;
          q.IB_Transaction.commit;
        finally
          freeandnil(q);
        end;
      except
        on e:exception do begin
          xlog('*-*DBPOOL_ERROR_ONChecking2:' + e.message);
          result:= nil;
        end;
      end;
    end;
  finally
    CS.Release;
  end;
end;