Skip to content
Permalink
Browse files

SynDBZeos: prevent implicitly connection opening inside TSQLDBZEOSCon…

…nection.Create
  • Loading branch information...
pavel.mash
pavel.mash committed Mar 6, 2019
1 parent 8deaae9 commit 2fd15cf13889f69708adddc78ab1eb84ab201b86
Showing with 6 additions and 4 deletions.
  1. +6 −4 SynDBZeos.pas
@@ -772,10 +772,6 @@ constructor TSQLDBZEOSConnection.Create(aProperties: TSQLDBConnectionProperties)
inherited Create(aProperties);
url := (fProperties as TSQLDBZEOSConnectionProperties).fURL;
fDatabase := DriverManager.GetConnectionWithParams(url.URL,url.Properties);
fDatabase.SetReadOnly(false);
// about transactions, see https://synopse.info/forum/viewtopic.php?id=2209
fDatabase.SetAutoCommit(true);
fDatabase.SetTransactionIsolation(tiReadCommitted);
end;

procedure TSQLDBZEOSConnection.Connect;
@@ -788,7 +784,13 @@ procedure TSQLDBZEOSConnection.Connect;
Log := SynDBLog.Enter(Self,pointer(FormatUTF8('Connect to % % for % at %:%',
[Protocol,Database,HostName,Port])),true);
try
// about transactions, see https://synopse.info/forum/viewtopic.php?id=2209
// two statement below do not require DB to be connected, so can be before Open
fDatabase.SetAutoCommit(true);
fDatabase.SetTransactionIsolation(tiReadCommitted);
fDatabase.Open;
fDatabase.SetReadOnly(false);

Log.Log(sllDB,'Connected to % using % %',
[fProperties.ServerName,fProperties.DatabaseName,fDatabase.GetClientVersion]);
inherited Connect; // notify any re-connection

0 comments on commit 2fd15cf

Please sign in to comment.
You can’t perform that action at this time.