#1 2019-06-11 17:02:33

EMartin
Member
From: Buenos Aires - Argentina
Registered: 2013-01-09
Posts: 332

Small bug in SynDB.pas

Hi @ab, there is a small bug in SynDB.pas:

function TSQLDBConnectionPropertiesThreadSafe.CurrentThreadConnectionIndex: Integer;
var id: TThreadID;
    tix: Int64;
    conn: TSQLDBConnectionThreadSafe;
begin // caller made EnterCriticalSection(fConnectionCS)
  if self<>nil then begin
    ...
    result := 0;
--    while result<fConnectionPool.Count-1 do begin
++    while result<fConnectionPool.Count do begin
      conn := TSQLDBConnectionThreadSafe(fConnectionPool.List[result]);
      if conn.IsOutdated(tix) then // to guarantee reconnection
        fConnectionPool.Delete(result) else begin
        if conn.fThreadID=id then begin
          fLatestConnectionRetrievedInPool := result;
          exit;
        end;
        inc(result);
      end;
    end;
  end;
  result := -1;
end;

Just remove the -1 (minus one).

Thanks.


Esteban

Offline

#2 2019-06-12 09:45:21

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

Re: Small bug in SynDB.pas

FIxed by https://synopse.info/fossil/info/30a48e5b16

Thanks for the feedback!

Offline

Board footer

Powered by FluxBB