Page 1 of 1

How to avoid "cannot update this query type" ?

Posted: 02.03.2006, 19:39
by anse123
- DBMS: MySQL
- ZQuery.SQL is "select * from mytable limit 0,10"

When I do a ZQuery.Post through a TDBGrid and a TDatasource I get the error "cannot update this query type". I thought this error only raises when doing queries with joins or some aggregate-functions in it??

Regards,
Ansgar

Posted: 03.03.2006, 14:10
by mdaems
Hi Ansgar,

Did you try without the limit clause? Probably it is treated as aggregate?

Mark

Posted: 03.03.2006, 21:17
by anse123
Strange: sometimes i can update with LIMIT-queries and sometimes not. I have a slight idea that only tables with a primary key can be updated, because one table I cannot update has no PK and another with a PK can be updated...

By the way: the "ZQuery.WhereMode" is set to "wmWhereAll" - don't know if this is important but the other option "wmWhereKeyOnly" sounds as if one cannot update/delete tables without PK?

And BTW: is there a more detailed documentation of ZeosLIB available?

Regards,
Ansgar

Posted: 04.03.2006, 14:23
by mdaems
Hi Ansgar,

I think you've found the reason. why don't you try adding an autonumber pk-column? Don't forget to include it in your query. * will do of course. Doesn't cost that much, isn't it?

Checked the knowledge base? I know there are some busy creating docs but I don't know how far they are.

Mark

Posted: 04.03.2006, 14:34
by ste_ba
Hi,

we're working on it :-) We know there's need for more documentation. Numerous questions are answered in the knowledge base, but more remain.

BTW, did you check the "RequestLive" property? Should be set to "true".

Stefan

Posted: 04.03.2006, 14:52
by mdaems
Stefan,

Was that one not been removed??? Still using an old version as I only have D5, but I read some changes have been done concerning read-only and requestlive.

Mark

Posted: 09.03.2006, 11:44
by anse123
Stefan,

"RequestLive" was renamed to "ReadOnly" in 6.5.1 . And if I set ReadOnly:=true, I cannot edit data at all, as one would expect when setting the query to "readonly" ...

Ansgar

Posted: 12.03.2006, 09:02
by zippo
Maybe I've found another situation that leads to this error. I have a similar problem when I want to post into a Temporary table. It has indexes.

I hope the developer to fix this issue as soon as possible, because I used to work with temporary tables in Zeos 5.x and now I have a quite serious problem.. :cry: ...

If the fix is not just behind the corner then please address me to the solution - even a dirty one. :P

Posted: 18.03.2006, 20:04
by waheed
As strange as this could be this select

SELECT * from `TABLE_NAME`

could also cause the problem

remove the ` character and the problem is solved
:shock:

Posted: 20.03.2006, 10:39
by zippo
I don't use this char.. :( Any other idea?

Posted: 21.03.2006, 14:53
by misio
the problem i have is where name of table is for egzample:
Table NAme - two strings and nothing works :Q

and second problem:

strange as this could be this select

Code: Select all

SELECT * from `TABLE_NAME` 

could also cause the problem 

remove the ` character and the problem is solved 
this works but ... thn query dont read all fields dont read for egzample geo , linestring, polygons ...

Posted: 25.03.2006, 20:23
by zippo
It also happens if posting into a temporary table in MySQL 5.x! :(

Posted: 07.04.2006, 18:17
by trysho
i have the same problem ... ZQuery.Post just dont do anythin!! please dont let this thread die!! ... 3 days of work and nothing happends =( ... anybody has another idea?

Posted: 07.04.2006, 19:41
by mdaems
Trysho,

Do you have more details? Zippo's problem with the temporary tables is solved by a very recent patch to the code. If you get the svn version or the patch submitted in an other thread that's solved. If your query is something else, just tell us more. Versions of Zeos, delphi, mysql. Create of your table, the query...

Mark

Yipieeee!!

Posted: 07.04.2006, 21:02
by trysho
Well ... it wasnt that bad ... i solve the problem ... was my fault, i just put ZQuery.Open instead ZQuery.ExecSQL and Append, Edit, Post and Cancel Methods work fine (until now) ...

im sorry for the details, i use a Borland Delphi 2006 with Zeos 6.5.1 alpha and MySQL 4.1. The issue was that if ZQuery its open with .Open method, ZQuery assumes the role of a table with the resultset, if i use the .ExecSQL method the Query its executed in MySQL, and the resultset becomes read only (ExecSQL is used only for update, delete and alter statements), so, i saw my data in the DBEdits but i cant do anything with append, edit or post, it just dont work.

With Open, the ZQuery accepts append, edit and post just as a ZTable do ...

im very happy, because my project works completely with this 3 methods, i hope this help somebody else. Thank you anyway.