Nevermind. I replaced the SQLdb components with UIB and the grid worked fine.SQLdb components are much more used by Free Pascal and Lazarus audience than UIB's.
It looks as if the problem is in the interaction between SQLdb and either the TDataset or TDatasource.
I don't do much visual development with Lazarus (it is usually non-gui based stuff), so I chose the SQLDB components precisely because they were already available. I didn't want to go to the trouble of installing UIB as an additional package.I can confirm the issue.
Anyway, I've attached the app. It is very simple. The only requirement is that there needs to be one additional connection to the database, perhaps by isql, or flamerobin or whatever.
As I mentioned previously, after changing the components for the UIB equivalents everything 'just works'. It is possible that I might have changed some obscure setting while changing the components, but even then, the app should not crash when using SQLDB.
But I think this is a bug anyway. The app is just blown out of the water. It is impossible to debug this problem, otherwise I would have done so.You can debug lcl (lazarus-libs) or fcl (fp-libs) when you compile lazarus and fpc in development mode.
If there is a circular reference between the query object and the datasource that should be caught, perhaps at design time, shouldn't it? I'm trying to imagine how that could be a feature, especially in this case when the original query takes no parameters.It is for TSQLQuery impossible to detect if the datasource component is for results or for paramater values.
If there is a circular reference between the query object and the datasource that should be caught, perhaps at design time, shouldn't it? I'm trying to imagine how that could be a feature, especially in this case when the original query takes no parameters.It is for TSQLQuery impossible to detect if the datasource component is for results or for paramater values.
Paul, I've a made and attached a small example, as simple and educative as I could think of, on how to use TSQLQuery.DataSource.If there is a circular reference between the query object and the datasource that should be caught, perhaps at design time, shouldn't it? I'm trying to imagine how that could be a feature, especially in this case when the original query takes no parameters.It is for TSQLQuery impossible to detect if the datasource component is for results or for paramater values.
It is possible for TSQLQuery to detect a circular reference. TDataset has an 'IsLinkedTo' method. If it returns true there is a circular reference and an error should be thrown. An example of how this is done can be found in IBX2:
procedure TIBCustomDataSet.SetDataSource(Value: TDataSource); begin if IsLinkedTo(Value) then IBError(ibxeCircularReference, [nil]); if FDataLink <> nil then FDataLink.DataSource := Value; end;
TSQLQuery tries to detect the circular reference, but seems to fail:
procedure TCustomSQLQuery.SetDataSource(AValue: TDataSource); Var DS : TDataSource; begin DS:=DataSource; If (AValue<>DS) then begin If Assigned(AValue) and (AValue.Dataset=Self) then DatabaseError(SErrCircularDataSourceReferenceNotAllowed,Self); If Assigned(DS) then DS.RemoveFreeNotification(Self); FStatement.DataSource:=AValue; end; end;