Page 1 of 1

[solved] Problem with TZquery

Posted: 23.12.2013, 11:11
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.

Re: Problem with TZquery

Posted: 27.12.2013, 23:52
by mrossij
Hi,
no one can assume something about this topic?

Re: Problem with TZquery

Posted: 28.12.2013, 21:38
by miab3
@mrossij

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

Michal

Re: Problem with TZquery

Posted: 31.12.2013, 18:54
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!)

Re: Problem with TZquery

Posted: 01.01.2014, 16:50
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.

Re: Problem with TZquery

Posted: 08.01.2014, 14:57
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.

Re: Problem with TZquery

Posted: 08.01.2014, 14:59
by mrossij
Excuse my forgetfulness: in fact 'status' is an index field.