[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.
mrossij
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 21.11.2009, 19:00

[solved] Problem with TZquery

Postby mrossij » 23.12.2013, 11:11

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

Postby mrossij » 27.12.2013, 23:52

Hi,
no one can assume something about this topic?

miab3
Zeos Test Team
Zeos Test Team
Posts: 950
Joined: 11.05.2012, 12:32
Location: Poland

Re: Problem with TZquery

Postby miab3 » 28.12.2013, 21:38

@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

Postby mrossij » 31.12.2013, 18:54

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 Dev Team
Zeos Dev Team
Posts: 1739
Joined: 31.03.2011, 22:38

Re: Problem with TZquery

Postby EgonHugeist » 01.01.2014, 16:50

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.
King regards, Michael

You want to help? 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

Postby mrossij » 08.01.2014, 14:57

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

Postby mrossij » 08.01.2014, 14:59

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


Return to “ZeosLib 7.0 Stable Forum”

Who is online

Users browsing this forum: No registered users and 1 guest