Bug in TZSQLMetadata resultset caching
Posted: 14.04.2018, 15:57
Hi,
I think I may have tracked down the cause for the problem I reported in http://zeoslib.sourceforge.net/viewtopi ... 40&t=73973:
It seems that the metadata TZVirtualResultset which has been cached for some combination of tablename and property will be closed, when TZSQLMetadata.Close is called. So, if I want to use TZSQLMetadata to get some info for a table and at a later time I want to get the same info again, this will not work, because the cached resultset has been cleared.
There is actually a guard (property DoNotCloseResultset) which could be used to prevent this in the special case where a resultset is cached.
So I tried the following and it seems to work:
1. In ZAbstractRODataset.pas modify the property declaration of DoNotCloseResultset (make it writable):
2. In ZSqlMetadata.pas, override the InternalClose method:
I have not yet checked if this introduces any memory leaks or affects other components, but I do not think that it should.
Can somebody please approve and include this fix (or anything else that targets this problem)?
Thank you very much.
Best regards
Gunnar
I think I may have tracked down the cause for the problem I reported in http://zeoslib.sourceforge.net/viewtopi ... 40&t=73973:
It seems that the metadata TZVirtualResultset which has been cached for some combination of tablename and property will be closed, when TZSQLMetadata.Close is called. So, if I want to use TZSQLMetadata to get some info for a table and at a later time I want to get the same info again, this will not work, because the cached resultset has been cleared.
There is actually a guard (property DoNotCloseResultset) which could be used to prevent this in the special case where a resultset is cached.
So I tried the following and it seems to work:
1. In ZAbstractRODataset.pas modify the property declaration of DoNotCloseResultset (make it writable):
Code: Select all
property DoNotCloseResultset: Boolean read FDoNotCloseResultset write FDoNotCloseResultset;
Code: Select all
TZSQLMetadata = class(TZAbstractRODataset)
protected
...
procedure InternalClose; override;
...
Code: Select all
procedure TZSQLMetadata.InternalClose;
begin
DoNotCloseResultSet := true;
inherited;
end;
Can somebody please approve and include this fix (or anything else that targets this problem)?
Thank you very much.
Best regards
Gunnar