Browse Source

* Fix bug ID #0036148

git-svn-id: trunk@43154 -
michael 5 years ago
parent
commit
e67989a8e8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      packages/fcl-db/src/sqldb/sqldb.pp

+ 5 - 2
packages/fcl-db/src/sqldb/sqldb.pp

@@ -2410,8 +2410,11 @@ begin
     CloseDataSets;
     CloseDataSets;
     If LogEvent(detCommit) then
     If LogEvent(detCommit) then
       Log(detCommit,SCommitting);
       Log(detCommit,SCommitting);
-    // FTrans=Nil for the case of forced close.
-    if (FTrans=Nil) or (stoUseImplicit in Options) or SQLConnection.AttemptCommit(FTrans) then
+    // The inherited closetrans must always be called.
+    // So the last (FTrans=Nil) is for the case of forced close. (Bug IDs 35246 and 33737)
+    // Order is important:
+    // some connections do not have FTrans, but they must still go through AttemptCommit.
+    if (stoUseImplicit in Options) or SQLConnection.AttemptCommit(FTrans) or (FTrans=Nil) then
       begin
       begin
       CloseTrans;
       CloseTrans;
       FreeAndNil(FTrans);
       FreeAndNil(FTrans);