[solved] ZQuery.Open internally requests metadata

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
AlexGA
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 21.09.2012, 02:51

[solved] ZQuery.Open internally requests metadata

Post by AlexGA »

Hello!

First of all, excuse me for my English.

Problem: Some of RDBMS functions (like FOUND_ROWS() in
MySQL) must be called immediately after SQL command executive. When we
call TZQuery.Open, we send to server SQL statment, after that
TZQuery internally requests metadata from server. So, TZQuery.Open not
only send SQL request to server, but send commands (or another sql statments) to
get metadata. If after that we call RDBMS function (ZQueryCount.SQL =
'SELECT FOUND_ROWS() AS RecsCount'; ZQueryCount.Open), function return
wrong result.

Question: How i can send request to RDBMS, after method TZDataSet.Open send
SQL statement to server, but before TZDataSet.Open requests metadata?

I think Event like TZDataSet.AfterSqlSendBeforeGetMetadata can help,
but i do not now architecture of ZEOS library and can't implement
event.

Any ideas?
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

AlexGA,

Nice proposal, but a BIG job. Actually i have no idea what the purpose of FOUND_ROWS is. Why not check the TZDataSet.RecordCount?

Next proposal: TZConnection.UseMetadata.:= false (untested so it would be interesing to know if it works property..) That option does suppress fetching the MetaInformations.

What do you think?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
AlexGA
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 21.09.2012, 02:51

Post by AlexGA »

EgonHugeist wrote:AlexGA,

Nice proposal, but a BIG job. Actually i have no idea what the purpose of FOUND_ROWS is. Why not check the TZDataSet.RecordCount?

Next proposal: TZConnection.UseMetadata.:= false (untested so it would be interesing to know if it works property..) That option does suppress fetching the MetaInformations.

What do you think?
If we use SQL statment with limitation of result records count (like SELECT TOP 100 ....) TZDataSet.RecordCount store actually fetched records count from server (not greater then 100). Function FOUND_ROWS return total record count of previous SQL but without limitation. It need to implement statistic like "FETCHED ROWS 100 OF 2546"

I do not know if TZDataSet without metaInformation will be work correctly...
I will try TZConnection.UseMetadata:= false.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

AlexGA,

Ok now i understand the purpose of this command. Nice to know.

Accordingly UseMetadata=false:

It will work nice for tables/views but i know it won't work with the TZStoredProc component. Here the Metainformations are required to get the parameters running.

I hope you question is solved..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
AlexGA
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 21.09.2012, 02:51

Post by AlexGA »

I set TZConnection.UseMetadata := false

All work fine!!!

Thank you very much!

Question is solved.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Just for your information : setting this UseMetadata to false also has side effects. One of them is that all datasets will not be able to perform updates without using a TZUpdateSQL component as zeoslib can't find out how to update the data on the database side.

Mark
Image
Locked