From 0bbab1f1630bcb99c253e4f8b35c2fc0a9b20a58 Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Sat, 18 Feb 2006 16:06:58 +0000 Subject: [PATCH] Accept empty results from selection_domain and selection_report. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5740 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../sql/erp5_mysql/z_count_results.zsql | 20 +++++++++++++++---- .../sql/erp5_mysql/z_search_results.zsql | 20 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_count_results.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_count_results.zsql index 60b1ee6421..8429580465 100755 --- a/product/ERP5Catalog/sql/erp5_mysql/z_count_results.zsql +++ b/product/ERP5Catalog/sql/erp5_mysql/z_count_results.zsql @@ -19,18 +19,30 @@ SELECT </dtml-if> FROM <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> - <dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if> - <dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if> + <dtml-if selection_domain> + <dtml-let expression="selection_domain.asSqlJoinExpression()"> + <dtml-if expression> , <dtml-var expression> </dtml-if> + </dtml-let> + </dtml-if> + <dtml-if selection_report> + <dtml-let expression="selection_report.asSqlJoinExpression()"> + <dtml-if expression> , <dtml-var expression> </dtml-if> + </dtml-let> + </dtml-if> WHERE 1 = 1 <dtml-if where_expression> AND <dtml-var where_expression> </dtml-if> <dtml-if selection_domain> - AND <dtml-var "selection_domain.asSqlExpression()"> + <dtml-let expression="selection_domain.asSqlExpression()"> + <dtml-if expression> AND <dtml-var expression> </dtml-if> + </dtml-let> </dtml-if> <dtml-if selection_report> - AND <dtml-var "selection_report.asSqlExpression(strict_membership=1)"> + <dtml-let expression="selection_report.asSqlExpression(strict_membership=1)"> + <dtml-if expression> AND <dtml-var expression> </dtml-if> + </dtml-let> </dtml-if> <dtml-if sort_on> ORDER BY diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_search_results.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_search_results.zsql index 34682a9e21..88e193cd9a 100755 --- a/product/ERP5Catalog/sql/erp5_mysql/z_search_results.zsql +++ b/product/ERP5Catalog/sql/erp5_mysql/z_search_results.zsql @@ -20,8 +20,16 @@ SELECT DISTINCT FROM <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in> - <dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if> - <dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if> + <dtml-if selection_domain> + <dtml-let expression="selection_domain.asSqlJoinExpression()"> + <dtml-if expression> , <dtml-var expression> </dtml-if> + </dtml-let> + </dtml-if> + <dtml-if selection_report> + <dtml-let expression="selection_report.asSqlJoinExpression()"> + <dtml-if expression> , <dtml-var expression> </dtml-if> + </dtml-let> + </dtml-if> WHERE 1 = 1 @@ -29,10 +37,14 @@ WHERE AND <dtml-var where_expression> </dtml-if> <dtml-if selection_domain> - AND <dtml-var "selection_domain.asSqlExpression()"> + <dtml-let expression="selection_domain.asSqlExpression()"> + <dtml-if expression> AND <dtml-var expression> </dtml-if> + </dtml-let> </dtml-if> <dtml-if selection_report> - AND <dtml-var "selection_report.asSqlExpression(strict_membership=1)"> + <dtml-let expression="selection_report.asSqlExpression(strict_membership=1)"> + <dtml-if expression> AND <dtml-var expression> </dtml-if> + </dtml-let> </dtml-if> <dtml-if sort_on> ORDER BY -- 2.30.9