Ver código fonte

* Added check for circular datasource reference

git-svn-id: trunk@8167 -
michael 18 anos atrás
pai
commit
9bc1c04688

+ 2 - 1
packages/fcl-db/src/dbconst.pas

@@ -95,7 +95,8 @@ Resourcestring
   SNoFieldIndexes          = 'No index currently active';
   SNoFieldIndexes          = 'No index currently active';
   SNotIndexField           = 'Field ''%s'' is not indexed and cannot be modified';
   SNotIndexField           = 'Field ''%s'' is not indexed and cannot be modified';
   SErrUnknownConnectorType = 'Unknown connector type';
   SErrUnknownConnectorType = 'Unknown connector type';
-
+  SErrCircularDataSourceReferenceNotAllowed = 'Circular datasource references are not allowed.';
+  
 
 
 Implementation
 Implementation
 
 

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

@@ -1413,6 +1413,8 @@ begin
   DS:=DataSource;
   DS:=DataSource;
   If (AValue<>DS) then
   If (AValue<>DS) then
     begin
     begin
+    If (AValue.Dataset=Self) then
+      DatabaseError(SErrCircularDataSourceReferenceNotAllowed,Self);
     If Assigned(DS) then
     If Assigned(DS) then
       DS.RemoveFreeNotification(Self);
       DS.RemoveFreeNotification(Self);
     If Assigned(AValue) then
     If Assigned(AValue) then