Page 1 of 1

Bug in TZSQLMetadata resultset caching

Posted: 14.04.2018, 15:57
by ga301
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):

Code: Select all

property DoNotCloseResultset: Boolean read FDoNotCloseResultset write FDoNotCloseResultset;
2. In ZSqlMetadata.pas, override the InternalClose method:

Code: Select all

TZSQLMetadata = class(TZAbstractRODataset)
protected
...
    procedure InternalClose; override;
...

Code: Select all

procedure TZSQLMetadata.InternalClose;
begin
  DoNotCloseResultSet := true;
  inherited;
end;
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

Re: Bug in TZSQLMetadata resultset caching

Posted: 27.04.2018, 07:50
by marsupilami
Hello Gunnar,

Egonhugeist told me that the problem should be fixed in the Zeos 7.2 branch by now as well. Could you please try that?
With best regards,

Jan

Re: Bug in TZSQLMetadata resultset caching

Posted: 26.06.2018, 06:45
by volkerp
Hello,

in 7.2.4 stable this problem persists :(
you can simple test it with the ZControlsExample example.

Re: Bug in TZSQLMetadata resultset caching

Posted: 26.06.2018, 08:46
by marsupilami
Hello Volker,

we didn't create a new release of Zeos 7.4 yet. If you need this bug fixed, you might want to download a snapshot from our SVN:
https://sourceforge.net/p/zeoslib/code- ... 2-patches/

We currently plan to release Zeos 7.2.6 in the upcoming weeks. Then this bug will be fixed in a release version.

Best regards,

Jan