How to avoid "cannot update this query type" ?

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
anse123
Junior Boarder
Junior Boarder
Posts: 26
Joined: 23.02.2006, 22:28

How to avoid "cannot update this query type" ?

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi Ansgar,

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

Mark
Image
anse123
Junior Boarder
Junior Boarder
Posts: 26
Joined: 23.02.2006, 22:28

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
User avatar
ste_ba
Zeos Dev Team
Zeos Dev Team
Posts: 29
Joined: 15.02.2006, 20:26
Location: Lahntal
Contact:

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
anse123
Junior Boarder
Junior Boarder
Posts: 26
Joined: 23.02.2006, 22:28

Post 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
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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
waheed
Junior Boarder
Junior Boarder
Posts: 26
Joined: 18.11.2005, 21:41

Post 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:
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

I don't use this char.. :( Any other idea?
misio
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 10.03.2006, 09:21

Post 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 ...
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

It also happens if posting into a temporary table in MySQL 5.x! :(
trysho
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 07.04.2006, 17:59

Post 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?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
trysho
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 07.04.2006, 17:59

Yipieeee!!

Post 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.
Post Reply