Bug in TZSQLMetadata resultset caching

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
ga301
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 07.04.2018, 20:47

Bug in TZSQLMetadata resultset caching

Postby ga301 » 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/viewtopic.php?f=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

marsupilami
Gold Boarder
Gold Boarder
Posts: 671
Joined: 17.01.2011, 14:17

Re: Bug in TZSQLMetadata resultset caching

Postby marsupilami » 27.04.2018, 07:50

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


Return to “ZeosLib 7.2 Forum”

Who is online

Users browsing this forum: No registered users and 0 guests