Re: [Zope] Z SQL Methods and the SQL LIMIT clause
Assuming MySQL, I found the fix for this was to go the Advanced tab for the ZSQL Method (in the ZMI) and set Maximum Rows to Retrieve to zero. After that, my limit clause worked without a problem. On 5/11/05, Asad Habib [EMAIL PROTECTED] wrote: Is there a reason why Z SQL methods do not allow the use of the LIMITclause? I am absolutely certain that my query has the right syntax since I executed it against the MySQL server and it gave me the correct results.FYI, I have provided the query below:SELECT course_id FROM courseWHERE course_id 991000ORDER BY course_id DESC LIMIT 1 Furthermore, Zope throws the following error when I try to test this queryvia the ZMI and also when I use it in my application:(1064, You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'LIMIT 1000' at line 3)Any help would be appreciated. Thank you.- Asad___Zope maillist-Zope@zope.org http://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding!**(Related lists - http://mail.zope.org/mailman/listinfo/zope-announcehttp://mail.zope.org/mailman/listinfo/zope-dev )___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Z SQL Methods and the SQL LIMIT clause
On 5/11/05, Asad Habib [EMAIL PROTECTED] wrote: Is there a reason why Z SQL methods do not allow the use of the LIMIT clause? I am absolutely certain that my query has the right syntax since I executed it against the MySQL server and it gave me the correct results. FYI, I have provided the query below: SELECT course_id FROM course WHERE course_id 991000 ORDER BY course_id DESC LIMIT 1 Furthermore, Zope throws the following error when I try to test this query via the ZMI and also when I use it in my application: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1000' at line 3) LIMIT is not a standard SQL clause. ZMySQLDA uses it internally, based upon the max_row properties of the Z SQL Method. If you want to use it, get rid of the LIMIT clause in your query, and set the max_rows property accordingly. Also, you can trick ZMySQLDA into not adding a LIMIT by putting a comment before your SQL statement. http://www.zope.org/Members/adustman/Tips/no_limits -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-dev] Re: [Zope] Z SQL Methods appear broken in 2.4.x
This works for me (Zope 2.4 branch, ZMysqlDA). Do you have a traceback ? Andreas - Original Message - From: Joseph J Wolff [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, September 28, 2001 15:56 Subject: [Zope] Z SQL Methods appear broken in 2.4.x It appears that Z SQL Methods are broken in 2.4.x. Specifically, the type=string in a dtml-sqlvar is broken - a simple ZSQL query such as: select id, cost, name from choices where name = dtml-sqlvar nam type=string results in the following error: exceptions.NameError: global name 'string' is not defined It's broken on 2.4.0 and 2.4.1, and works fine on 2.2.5, 2.3.0, and 2.3.2 - in fact, it's in production on our 2.2.5. Integer parameters work fine. It's hard to believe that no one else has run into this, and that the stable 2.4.x branch has gotten this far without anyone noticing this - I've even tried it on 2 different servers running Zope 2.4 (2.4.1 on FreeBSD 4.0, our production web server, and 2.4.0 on FreeBSD 4.3, our dev server) Any ideas? Regards, joe Joseph J Wolff eRacks Open Source Rackmount Systems www.eracks.com [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )