Page 1 of 1

Patch for PSQL Accessviolation

Posted: 06.04.2014, 12:31
by Michl
I have received an access violation because a column was inserted into a table. See topic http://zeoslib.sourceforge.net/viewtopi ... 38&t=11384

The reason was that an active connection has not registered that the metadata has changed, because all TableInfos are cached - for performance reasons.

I have attached a patch where I first check if the cached column number of the current column number corresponds. If not, the cache is updated. It will only read data used for comparison is therefore virtually no perfomance loss there. An error that persists is, if not the number of columns will change, but for example their name. However, this is imho negligible.

For me, the patch works fine now, whether it can be taken as 1:1 or whether this functionality would also be adapted for other databases, I do not know.

Greetings Michl

[edit] I forgot a "Refresh", changed patch attached

Re: Patch for PSQL Accessviolation

Posted: 27.06.2014, 23:28
by EgonHugeist
Hi michl,

i'll check this out and give you a second reply...

Re: Patch for PSQL Accessviolation

Posted: 28.06.2014, 23:10
by EgonHugeist
Me again, just did check your patch...
I did change some parts: intead of clearing the whole chache i simple refresh the data of the current entry. Hope you agree.

Patch done R3181 /testing-7.2 (SVN)

But thinking about it makes me .... What happens if just a columnname did change? IMO the field should become readonly because the compare between geneic PG-Data and Metadata fails, or am i wrong?

Cheers Michael

Re: Patch for PSQL Accessviolation

Posted: 01.07.2014, 21:35
by Michl
I've updated my zeos and make some tests. In that tests and in my project it seems to work. :D

Thank you for your work! Now I have not to patch zeos, when I should reinstall my Lazarus, very nice! :loveit: