You are not logged in Log in Join
You are here: Home » Members » Andy Dustman's Zope Stuff » Tips » Don't use LIMIT with ZMySQLDA-2.0.x » tip_view

Log in
Name

Password

 

Created by ZopeOrgSite . Last modified 2001-06-12 15:41:04.

When using Z SQL Methods on a ZMySQLDA Database Connection, don't add a LIMIT clause. ZMySQLDA does this for you, based on the max_rows property of the Z SQL Method. This makes ZMySQLDA much faster on large result sets. LIMIT is a non-standard MySQL extension, so you should avoid using it in queries anyway. But, if you really need a LIMIT clause, set the max_rows property of the Z SQL Method to zero, and ZMySQLDA won't add one. Alternatively, you can trick ZMySQLDA into leaving the limit out by putting a comment just before the SELECT statement.

Side note: Use <dtml-var sql_delimiter&rt; instead of semicolon (;) to separate multiple SQL statements in the same Z SQL Method.