From 647f44743153c6f8f7a4e6c472f48738e03cf19c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Tue, 25 Mar 2008 12:57:00 +0000
Subject: [PATCH] 2008-03-25 aurel * z_count_results must retrieve all rows by
 default as limit is explicitly given by catalog

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20109 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_mysql_innodb/z_count_results.xml     | 63 +++++++++++--------
 .../erp5_mysql_innodb_catalog/bt/change_log   |  3 +
 .../erp5_mysql_innodb_catalog/bt/revision     |  2 +-
 3 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml
index fb45d2b629..633192661d 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.ZSQLMethods.SQL</string>
-          <string>SQL</string>
-        </tuple>
-        <none/>
+        <global name="SQL" module="Products.ZSQLMethods.SQL"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -44,6 +41,12 @@
                                   <dictionary/>
                                 </value>
                             </item>
+                            <item>
+                                <key> <string>limit_expression</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
                             <item>
                                 <key> <string>select_expression</string> </key>
                                 <value>
@@ -75,12 +78,13 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-                            <string>from_table_list</string>
-                            <string>where_expression</string>
-                            <string>select_expression</string>
-                            <string>group_by_expression</string>
-                            <string>selection_domain</string>
-                            <string>selection_report</string>
+<string>from_table_list</string>
+<string>where_expression</string>
+<string>select_expression</string>
+<string>group_by_expression</string>
+<string>selection_domain</string>
+<string>selection_report</string>
+<string>limit_expression</string>
                           </list>
                         </value>
                     </item>
@@ -97,12 +101,13 @@
         </item>
         <item>
             <key> <string>arguments_src</string> </key>
-            <value> <string>from_table_list\n
-where_expression\n
-select_expression\n
-group_by_expression\n
-selection_domain\n
-selection_report</string> </value>
+            <value> <string>from_table_list\r\n
+where_expression\r\n
+select_expression\r\n
+group_by_expression\r\n
+selection_domain\r\n
+selection_report\r\n
+limit_expression</string> </value>
         </item>
         <item>
             <key> <string>cache_time_</string> </key>
@@ -118,9 +123,7 @@ selection_report</string> </value>
         </item>
         <item>
             <key> <string>connection_hook</string> </key>
-            <value>
-              <none/>
-            </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>connection_id</string> </key>
@@ -136,7 +139,7 @@ selection_report</string> </value>
         </item>
         <item>
             <key> <string>max_rows_</string> </key>
-            <value> <int>1</int> </value>
+            <value> <int>0</int> </value>
         </item>
         <item>
             <key> <string>src</string> </key>
@@ -182,6 +185,9 @@ ORDER BY\n
 GROUP BY\n
   <dtml-var group_by_expression>\n
 </dtml-if>\n
+<dtml-if limit_expression>\n
+LIMIT <dtml-var "limit_expression">\n
+</dtml-if>\n
 
 
 ]]></string> </value>
@@ -191,9 +197,11 @@ GROUP BY\n
             <value>
               <object>
                 <klass>
-                  <global name="SQL" module="Shared.DC.ZRDB.DA"/>
+                  <global name="__newobj__" module="copy_reg"/>
                 </klass>
-                <none/>
+                <tuple>
+                  <global name="SQL" module="Shared.DC.ZRDB.DA"/>
+                </tuple>
                 <state>
                   <dictionary>
                     <item>
@@ -252,13 +260,16 @@ WHERE\n
     <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
   </dtml-let>\n
 </dtml-if>\n
+<dtml-if sort_on>\n
+ORDER BY\n
+  <dtml-var sort_on>\n
+</dtml-if>\n
 <dtml-if group_by_expression>\n
 GROUP BY\n
   <dtml-var group_by_expression>\n
 </dtml-if>\n
-<dtml-if sort_on>\n
-ORDER BY\n
-  <dtml-var sort_on>\n
+<dtml-if limit_expression>\n
+LIMIT <dtml-var "limit_expression">\n
 </dtml-if>\n
 
 
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
index d861097661..f969b1a091 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/change_log
@@ -1,3 +1,6 @@
+2008-03-25 aurel
+* z_count_results must retrieve all rows by default as limit is explicitly given by catalog
+
 2007-06-22 yo
 * Remove keyword keys, because there is no way to disable them later.
 
diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
index 105d7d9ad3..dec4c59e4a 100644
--- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
+++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
@@ -1 +1 @@
-100
\ No newline at end of file
+104
\ No newline at end of file
-- 
2.30.9