"Datasource makes a circular link" exception when assign datasource to nil
Posted: 31.07.2022, 11:27
Hello everyone. I have a strange problem with Zeos.
In both way :
* Select "(none)" for DataSource in IDE
* ZQuery3.DataSource := nil; in code and run
I get "Datasource makes a circular link" exception in here.
Lazarus 2.2.2 Fpc 3.2.2 Zeos 7.2.14.0
---- Edit ----
Put on a datamodule
two TZQuery as ZQuery2 and ZQuery3
two TDataSource as DataSource2 and DataSource3
make these assigments by using IDE
DataSource2.DataSet :=ZQuery2;
DataSource3.DataSet :=ZQuery3;
keep both queries' SQL property empty.
Set ZQuery3.DataSource :=DataSource2 by using IDE
Set ZQuery3.DataSource :=(none) by using IDE or
ZQuery3.DataSource :=nil; by programmatically. In both way, you get the exception.
I tried same with TIBQuery components from Firebird page, I got no exception.
In both way :
* Select "(none)" for DataSource in IDE
* ZQuery3.DataSource := nil; in code and run
I get "Datasource makes a circular link" exception in here.
{ZAbstractRODataSet.pas}procedure TZAbstractRODataset.SetDataSource(Value: TDataSource); begin {$IFNDEF FPC} if IsLinkedTo(Value) then {$ELSE} if Value.IsLinkedTo(Self) then {$ENDIF} raise EZDatabaseError.Create(SCircularLink); DataLink.DataSource := Value; end;
{datasource.inc} Function TDataSource.IsLinkedTo(ADataset: TDataSet): Boolean; var DS: TDataSource; begin Result:=False; Repeat DS:=aDataset.GetDataSource; Result:=(DS=Self); if Assigned(DS) then aDataSet := DS.DataSet else aDataSet := Nil; Until Result or (aDataset=Nil) end;ZQuery3:TZQuery SQL is empty.
Lazarus 2.2.2 Fpc 3.2.2 Zeos 7.2.14.0
---- Edit ----
Put on a datamodule
two TZQuery as ZQuery2 and ZQuery3
two TDataSource as DataSource2 and DataSource3
make these assigments by using IDE
DataSource2.DataSet :=ZQuery2;
DataSource3.DataSet :=ZQuery3;
keep both queries' SQL property empty.
Set ZQuery3.DataSource :=DataSource2 by using IDE
Set ZQuery3.DataSource :=(none) by using IDE or
ZQuery3.DataSource :=nil; by programmatically. In both way, you get the exception.
I tried same with TIBQuery components from Firebird page, I got no exception.