Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
958c3b87
Commit
958c3b87
authored
Aug 22, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQLCatalog: Stop relying on portal_selections for SQL expression generation
parent
68de872c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
50 deletions
+15
-50
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.sql
...Item/portal_catalog/erp5_mysql_innodb/z_count_results.sql
+0
-20
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml
...Item/portal_catalog/erp5_mysql_innodb/z_count_results.xml
+1
-3
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_search_results.sql
...tem/portal_catalog/erp5_mysql_innodb/z_search_results.sql
+0
-20
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_search_results.xml
...tem/portal_catalog/erp5_mysql_innodb/z_search_results.xml
+1
-3
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+13
-4
No files found.
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.sql
View file @
958c3b87
...
...
@@ -13,31 +13,11 @@ FROM
<
dtml
-
else
>
<
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
>
<
dtml
-
if
selection_domain
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = 'domain_category')"
>
<
dtml
-
if
expression
>
,
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
selection_report
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = 'report_category')"
>
<
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
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = 'domain_category')"
>
<
dtml
-
if
expression
>
AND
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
selection_report
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = 'report_category')"
>
<
dtml
-
if
expression
>
AND
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
sort_on
>
ORDER
BY
<
dtml
-
var
sort_on
>
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_count_results.xml
View file @
958c3b87
...
...
@@ -14,9 +14,7 @@
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
selection_domain\r\n
selection_report\r\n
where_expression\r\n
<value>
<string>
where_expression\r\n
select_expression\r\n
group_by_expression\r\n
from_table_list:list\r\n
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_search_results.sql
View file @
958c3b87
...
...
@@ -8,32 +8,12 @@ FROM
<
dtml
-
else
>
<
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
>
<
dtml
-
if
selection_domain
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = 'domain_category')"
>
<
dtml
-
if
expression
>
,
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
selection_report
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = 'report_category')"
>
<
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
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = 'domain_category')"
>
<
dtml
-
if
expression
>
AND
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
selection_report
>
<
dtml
-
let
expression
=
"portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = 'report_category')"
>
<
dtml
-
if
expression
>
AND
<
dtml
-
var
expression
>
</
dtml
-
if
>
</
dtml
-
let
>
</
dtml
-
if
>
<
dtml
-
if
group_by_expression
>
GROUP
BY
<
dtml
-
var
group_by_expression
>
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_search_results.xml
View file @
958c3b87
...
...
@@ -14,9 +14,7 @@
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
selection_domain\r\n
selection_report\r\n
where_expression\r\n
<value>
<string>
where_expression\r\n
select_expression\r\n
group_by_expression\r\n
from_table_list:list\r\n
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
958c3b87
...
...
@@ -143,6 +143,10 @@ else:
UID_BUFFER_SIZE
=
300
OBJECT_LIST_SIZE
=
300
# XXX 300 is arbitrary value of catalog object list
MAX_PATH_LEN
=
255
DOMAIN_STRICT_MEMBERSHIP_DICT
=
{
'selection_domain'
:
False
,
'selection_report'
:
True
,
}
manage_addSQLCatalogForm
=
DTMLFile
(
'dtml/addSQLCatalog'
,
globals
())
...
...
@@ -2229,6 +2233,13 @@ class Catalog(Folder,
empty_value_dict
=
{}
for
key
,
value
in
kw
.
iteritems
():
result
=
None
if
key
in
DOMAIN_STRICT_MEMBERSHIP_DICT
:
if
value
is
None
:
continue
value
=
self
.
getPortalObject
().
portal_selections
.
asDomainQuery
(
value
,
strict_membership
=
DOMAIN_STRICT_MEMBERSHIP_DICT
[
key
],
)
if
isinstance
(
value
,
dict_type_list
):
# Cast dict-ish types into plain dicts.
value
=
dict
(
value
)
...
...
@@ -2547,8 +2558,6 @@ class Catalog(Folder,
REQUEST
=
None
,
src__
=
0
,
build_sql_query_method
=
None
,
selection_domain
=
None
,
selection_report
=
None
,
# XXX should get zsql_brain from ZSQLMethod class itself
zsql_brain
=
None
,
implicit_join
=
False
,
...
...
@@ -2564,8 +2573,8 @@ class Catalog(Folder,
return
sql_method
(
src__
=
src__
,
zsql_brain
=
zsql_brain
,
selection_domain
=
selection_domain
,
selection_report
=
selection_report
,
selection_domain
=
None
,
# BBB
selection_report
=
None
,
# BBB
where_expression
=
query
[
'where_expression'
],
select_expression
=
query
[
'select_expression'
],
group_by_expression
=
query
[
'group_by_expression'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment