Browse Source

* Setting TSQLQuery.Transaction sets TSQLQuery.Database and vice versa. Same for TSQLTransaction.Database and Database.Transaction

git-svn-id: trunk@9433 -
michael 17 years ago
parent
commit
c4c6f3f655
1 changed files with 7 additions and 0 deletions
  1. 7 0
      packages/fcl-db/src/sqldb/sqldb.pp

+ 7 - 0
packages/fcl-db/src/sqldb/sqldb.pp

@@ -454,6 +454,8 @@ begin
     if Assigned(Value) then
       Value.Database := Self;
     FTransaction := Value;
+    If Assigned(FTransaction) and (FTransaction.Database=Nil) then
+      FTransaction.Database:=Self;
     end;
 end;
 
@@ -726,6 +728,9 @@ begin
       with TSQLConnection(DataBase) do
         if Transaction = self then Transaction := nil;
     inherited SetDatabase(Value);
+    If Assigned(Database) then
+      If (TSQLConnection(DataBase).Transaction=Nil) then
+        TSQLConnection(DataBase).Transaction:=Self;
     end;
 end;
 
@@ -759,6 +764,8 @@ Procedure TCustomSQLQuery.SetTransaction(Value : TDBTransaction);
 begin
   UnPrepare;
   inherited;
+  If (Transaction<>Nil) and (Database=Nil) then
+    Database:=TSQLTransaction(Transaction).Database;
 end;
 
 procedure TCustomSQLQuery.SetDatabase(Value : TDatabase);