[Zope] Z SQL Method: Error in select with limit (mysql)

Ed Leafe ed@leafe.com
Tue, 20 May 2003 08:31:16 -0400


On Tuesday, May 20, 2003, at 03:08  AM, Patrick Ulmer wrote:

> the select-statement for mysql i used in a "Z SQL Method"-object
>
> =A0 select gruppe as art from test order by gruppe limit 0, 1
>
> produce the following errormessage
>
> =A0 Error Value: (1064, "You have an error in your SQL syntax near=20
> 'LIMIT 1000' at line 1")
>
> why?

	Because Zope will automatically add the LIMIT 1000 to every ZSQL=20=

method as a precaution. To explicitly disable this so that you can set=20=

your own limit clause, you have to follow a little trick. In your ZSQL=20=

method, make the first line a comment, and then write your SQL. Like=20
this:

# ;
select gruppe as art
from test
order by gruppe
limit 0, 1



      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://opentech.leafe.com