4 |
4 |
** Module : where_clause_prep.rules
|
5 |
5 |
** Abstract : prepare for where clause conversion
|
6 |
6 |
**
|
7 |
|
** Copyright (c) 2005-2021, Golden Code Development Corporation.
|
|
7 |
** Copyright (c) 2005-2023, Golden Code Development Corporation.
|
8 |
8 |
**
|
9 |
9 |
** _#_ _I_ __Date__ __JPRM__ __________________________________Description___________________________________
|
10 |
10 |
** 001 GES 20051024 @23118 Prepare for where clause conversion.
|
... | ... | |
81 |
81 |
** 041 IAS 20210208 Do not convert CONTAINS arguments to upper case at conversion time.
|
82 |
82 |
** ECF 20210317 Ignore subscript on an extent field lvalue of a CONTAINS operation.
|
83 |
83 |
** IAS 20211004 Fixed conversion of INDEX and LOOKUP for case-sensitive arguments
|
|
84 |
** 042 IAS 20230220 Fixed nested CAN-FIND conversion
|
84 |
85 |
*/
|
85 |
86 |
-->
|
86 |
87 |
|
... | ... | |
175 |
176 |
<variable name="litDate" type="com.goldencode.p2j.util.date" />
|
176 |
177 |
<variable name="litDatetime" type="com.goldencode.p2j.util.datetime" />
|
177 |
178 |
<variable name="litDatetimetz" type="com.goldencode.p2j.util.datetimetz" />
|
|
179 |
<variable name="canFind" type="java.util.Set" />
|
178 |
180 |
|
179 |
181 |
<!-- expression libraries -->
|
180 |
182 |
<include name="common-progress" />
|
181 |
183 |
|
182 |
184 |
<func-library access="private">
|
183 |
185 |
|
|
186 |
<!-- detect whether node is part of a nested CAN-FIND expression -->
|
|
187 |
<function name="is_nested_can_find">
|
|
188 |
|
|
189 |
<variable name="ref" type="com.goldencode.ast.Aast" />
|
|
190 |
<return name="res" type="java.lang.Boolean" />
|
|
191 |
|
|
192 |
<expression>
|
|
193 |
ref = this.getAncestor(-1, prog.record_phrase)
|
|
194 |
</expression>
|
|
195 |
<expression>
|
|
196 |
res = ref != null and
|
|
197 |
ref.isAnnotation("nested_can_find") and
|
|
198 |
#(boolean) ref.getAnnotation("nested_can_find")
|
|
199 |
</expression>
|
|
200 |
|
|
201 |
</function>
|
|
202 |
|
184 |
203 |
<!-- test if this is the special case where a function gets
|
185 |
204 |
translated into the id field reference in FQL -->
|
186 |
205 |
<function name="test_for_id_function">
|
... | ... | |
272 |
291 |
<rule>bcCutoff = create("com.goldencode.p2j.util.date", 12, 31, -1)</rule>
|
273 |
292 |
<rule>bcDtCutoff = create("com.goldencode.p2j.util.datetime", 12, 31, -1, 0, 0)</rule>
|
274 |
293 |
<rule>bcDtzCutoff = create("com.goldencode.p2j.util.datetimetz", 12, 31, -1, 0, 0)</rule>
|
|
294 |
<rule>canFind = create("java.util.HashSet") </rule>
|
|
295 |
|
275 |
296 |
|
276 |
297 |
</init-rules>
|
277 |
298 |
|
... | ... | |
325 |
346 |
</while>
|
326 |
347 |
<action>colonRef.putAnnotation("sub_expression", true)</action>
|
327 |
348 |
</rule>
|
|
349 |
|
|
350 |
<rule>type == prog.table and getNoteBoolean("canfind")
|
|
351 |
<action>canFind.add(getNoteString("bufname"))</action>
|
|
352 |
</rule>
|
328 |
353 |
|
|
354 |
<rule>type == prog.record_phrase and !evalLib("is_nested_can_find")
|
|
355 |
<action>canFind.clear()</action>
|
|
356 |
</rule>
|
|
357 |
|
329 |
358 |
<rule>ignoreId == -1
|
330 |
359 |
|
331 |
360 |
<!-- this node can't be represented in FQL -->
|
... | ... | |
417 |
446 |
evalLib("subscript") or
|
418 |
447 |
idfunc or
|
419 |
448 |
evalLib("is_type_pair", prog.func_poly, prog.kw_if))
|
420 |
|
|
|
449 |
|
421 |
450 |
<!-- this is an FQL node (for AND, OR, NOT, and ternary IF this is
|
422 |
451 |
provisional only, until children can be checked) -->
|
423 |
452 |
<action>putNote("hql", true)</action>
|
... | ... | |
645 |
674 |
<!-- remember that this is the root node of a sub-expression
|
646 |
675 |
that must be evaluated on the client (and substituted
|
647 |
676 |
into the query) -->
|
|
677 |
|
648 |
678 |
<rule>!evalLib("is_type_pair", prog.func_logical, prog.kw_can_find)
|
649 |
679 |
<action>putNote("sub_expression", true)</action>
|
650 |
680 |
</rule>
|
651 |
|
|
652 |
681 |
<!-- sub-expressions rooted at a field reference to a related buffer in a
|
653 |
682 |
multi-table query need to be emitted with a field name -->
|
654 |
683 |
<rule>evalLib("fields") and getNoteBoolean("related_buffer")
|
... | ... | |
712 |
741 |
<action>copy.parent.putAnnotation("casesens", true)</action>
|
713 |
742 |
</rule>
|
714 |
743 |
</rule>
|
715 |
|
|
|
744 |
|
|
745 |
<action>test=false</action>
|
|
746 |
<rule>evalLib("fields")
|
|
747 |
<action>test = canFind.contains(getNoteString("bufname"))</action>
|
|
748 |
</rule>
|
716 |
749 |
<!-- this node can't be represented in FQL -->
|
717 |
|
<action on="false">putNote("hql", false)</action>
|
|
750 |
<action on="false">putNote("hql", test)</action>
|
718 |
751 |
|
719 |
752 |
</rule>
|
720 |
753 |
</rule>
|