[solved] Problem with TZquery

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

[solved] Problem with TZquery

Post by mrossij »

Hi,
I have a TzQuery like this:
Qry.Sql.Text: = 'select status from orders where no_orden ='' xxx'' ';
By performing these steps:
Qry.Edit;
Qry.FieldByName ('status'). AsString: = '5';
Qry.Post;

the query is executed on the MySQL database (activating the log) in this way:
UPDATE orders SET STATUS = '5' WHERE status = 1
?! How is this possible? I would have expected this parsing:
UPDATE orders SET STATUS = '5' where no_orden =' xxx '

I'm missing something or it may be an error of Zeos?

Thanks in advance.
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Re: Problem with TZquery

Post by mrossij »

Hi,
no one can assume something about this topic?
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: Problem with TZquery

Post by miab3 »

@mrossij

Everything is fine.
You editing dataset(Qry) ie updating the record on which the cursor is.

Michal
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Re: Problem with TZquery

Post by mrossij »

Thank you very much for response Miab3, but I do not understand.
Is correct that this query:
'select status from orders where no_orden = '2' ';
that specifies a field n_orden into the where, when I run the post the update-query created by Zeos uses a WHERE changed?
For me this is not correct! It should not be modified the original query with:
where status = 1 ????
How does Zeos to radically change the original query in the update?
(Sorry for my bad english!)
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Problem with TZquery

Post by EgonHugeist »

where status = 1 ????
How does Zeos to radically change the original query in the update?
Zeos determines the selected table. For us it doesn't matter which "where"-clause you're using for.
I assume field "status" might be an index? Otherwise it's the only field which changed it's data. So Zeos builds it's own "where"-clause. See Logging-Info.
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
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Re: Problem with TZquery

Post by mrossij »

Thank you so much EgonHugeist.
Thanks for the explanation.
In fact, I was given the same answer, although I was surprised me. Why not leave the 'where' clause as built ?. However, so is the implementation of Zeos and we have to accept it.
As always, give me a clear answer! :D . Thank you once again.

Bye.
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

Re: Problem with TZquery

Post by mrossij »

Excuse my forgetfulness: in fact 'status' is an index field.
Post Reply