Skip to content

Commit fe3c020

Browse files
committed
Added REPLICATION_MORE, REPLICATION_NOMORE, DATE_PARAMETERS, DATE_PARAMETERS_IN and DATE_PARAMETERS_OUT.
1 parent d2267d9 commit fe3c020

File tree

9 files changed

+209
-9
lines changed

9 files changed

+209
-9
lines changed

CodeGenEngine/ExpressionEvaluators/ExpressionEvaluatorLoopUtility.dbl

+53
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ namespace CodeGen.Engine
6666
loopUtilityExpressionEvaluators.Add("LAST", evaluateLast)
6767
loopUtilityExpressionEvaluators.Add("MORE", evaluateMore)
6868
loopUtilityExpressionEvaluators.Add("NOMORE", evaluateNoMore)
69+
loopUtilityExpressionEvaluators.Add("REPLICATION_MORE",evaluateReplicationMore)
70+
loopUtilityExpressionEvaluators.Add("REPLICATION_NOMORE",evaluateReplicationNoMore)
6971

7072
endmethod
7173

@@ -121,6 +123,57 @@ namespace CodeGen.Engine
121123
mreturn (loop.CurrentIndex == loop.MaxIndex)
122124
endmethod
123125

126+
private static method evaluateReplicationMore, boolean
127+
tkn, @Token
128+
template, @FileNode
129+
loops, @IEnumerable<LoopNode>
130+
endparams
131+
proc
132+
;The bahavior is similar to that of identical to that of evaluateMore (above)
133+
;except that this code takes into account any fields being excluded via the
134+
;special token REPLICATOR_EXCLUDE in field user text or long descripotion.
135+
136+
data excludedFields = 0
137+
foreach data fld in template.Context.GetCurrentStructure().Fields as @RpsField
138+
begin
139+
if (fld.HasProperty(template, "REPLICATOR_EXCLUDE"))
140+
begin
141+
excludedFields += 1
142+
end
143+
end
144+
145+
lambda isLoopNode(node) (node .is. LoopNode)
146+
data loop, @LoopNode, loops.Last(isLoopNode)
147+
148+
mreturn (loop.CurrentIndex < loop.MaxIndex - excludedFields)
149+
150+
endmethod
151+
152+
private static method evaluateReplicationNoMore, boolean
153+
tkn, @Token
154+
template, @FileNode
155+
loops, @IEnumerable<LoopNode>
156+
endparams
157+
proc
158+
;The bahavior is similar to that of identical to that of evaluateNoMore (above)
159+
;except that this code takes into account any fields being excluded via the
160+
;special token REPLICATOR_EXCLUDE in field user text or long descripotion.
161+
162+
data excludedFields = 0
163+
foreach data fld in template.Context.GetCurrentStructure().Fields as @RpsField
164+
begin
165+
if (fld.HasProperty(template, "REPLICATOR_EXCLUDE"))
166+
begin
167+
excludedFields += 1
168+
end
169+
end
170+
171+
lambda isLoopNode(node) (node .is. LoopNode)
172+
data loop, @LoopNode, loops.Last(isLoopNode)
173+
;; TODO: Should always return true if it's a primary key loop
174+
mreturn (loop.CurrentIndex == loop.MaxIndex - excludedFields)
175+
endmethod
176+
124177
;; *********************************************************************
125178

126179
private static method evaluateLoopProgress, boolean

CodeGenEngine/ExpressionEvaluators/ExpressionEvaluatorMethodLoop.dbl

+81-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ namespace CodeGen.Engine
9595
methodLoopExpressionEvaluators.Add("COERCE_USHORT", evaluateMethodReturnCorecedType)
9696

9797
;;Parameter types
98+
methodLoopExpressionEvaluators.Add("DATE_PARAMETERS", evaluateMethodDateParameters)
99+
methodLoopExpressionEvaluators.Add("DATE_PARAMETERS_IN", evaluateMethodDateParametersIn)
100+
methodLoopExpressionEvaluators.Add("DATE_PARAMETERS_OUT", evaluateMethodDateParametersOut)
98101
methodLoopExpressionEvaluators.Add("IN", evaluateMethodParametersIn)
99102
methodLoopExpressionEvaluators.Add("INOUT", evaluateMethodParametersInOut)
100103
methodLoopExpressionEvaluators.Add("IN_OR_INOUT", evaluateMethodParametersInOrInOut)
@@ -258,6 +261,82 @@ namespace CodeGen.Engine
258261
mreturn EvaluateMethodLoopExpression(tkn, template, loops, doEvaluate)
259262
endmethod
260263

264+
private static method evaluateMethodDateParameters, boolean
265+
tkn, @Token
266+
template, @FileNode
267+
loops, @IEnumerable<LoopNode>
268+
proc
269+
lambda doEvaluate(iface, meth, index)
270+
begin
271+
;;If there are no parameters we have our answer
272+
if (meth.Parameters.Count==0)
273+
mreturn false
274+
;;Otherwise go looking for any date parameters
275+
data param, @SmcParameter
276+
foreach param in meth.Parameters
277+
begin
278+
if param.Type == ParameterType.Decimal && (param.CoerceType == CoerceType.DateTime || param.CoerceType == CoerceType.DecimalNullable)
279+
begin
280+
mreturn true
281+
end
282+
end
283+
mreturn false
284+
end
285+
mreturn EvaluateMethodLoopExpression(tkn, template, loops, doEvaluate)
286+
endmethod
287+
288+
private static method evaluateMethodDateParametersIn, boolean
289+
tkn, @Token
290+
template, @FileNode
291+
loops, @IEnumerable<LoopNode>
292+
proc
293+
lambda doEvaluate(iface, meth, index)
294+
begin
295+
;;If there are no parameters we have our answer
296+
if (meth.Parameters.Count==0)
297+
mreturn false
298+
;;Otherwise go looking for any date parameters
299+
data param, @SmcParameter
300+
foreach param in meth.Parameters
301+
begin
302+
if param.Type == ParameterType.Decimal
303+
& && (param.CoerceType == CoerceType.DateTime || param.CoerceType == CoerceType.DecimalNullable)
304+
& && (param.Direction == ParameterDirection.In || param.Direction == ParameterDirection.InOut)
305+
begin
306+
mreturn true
307+
end
308+
end
309+
mreturn false
310+
end
311+
mreturn EvaluateMethodLoopExpression(tkn, template, loops, doEvaluate)
312+
endmethod
313+
314+
private static method evaluateMethodDateParametersOut, boolean
315+
tkn, @Token
316+
template, @FileNode
317+
loops, @IEnumerable<LoopNode>
318+
proc
319+
lambda doEvaluate(iface, meth, index)
320+
begin
321+
;;If there are no parameters we have our answer
322+
if (meth.Parameters.Count==0)
323+
mreturn false
324+
;;Otherwise go looking for any date parameters
325+
data param, @SmcParameter
326+
foreach param in meth.Parameters
327+
begin
328+
if param.Type == ParameterType.Decimal
329+
& && (param.CoerceType == CoerceType.DateTime || param.CoerceType == CoerceType.DecimalNullable)
330+
& && (param.Direction == ParameterDirection.Out || param.Direction == ParameterDirection.InOut)
331+
begin
332+
mreturn true
333+
end
334+
end
335+
mreturn false
336+
end
337+
mreturn EvaluateMethodLoopExpression(tkn, template, loops, doEvaluate)
338+
endmethod
339+
261340
private static method evaluateMethodParametersIn, boolean
262341
tkn, @Token
263342
template, @FileNode
@@ -389,10 +468,10 @@ namespace CodeGen.Engine
389468
proc
390469
lambda doEvaluate(iface, meth, index)
391470
begin
392-
;;If it's a function then we have our answer
471+
;;If there are no parameters we have our answer
393472
if (meth.Parameters.Count==0)
394473
mreturn false
395-
;;Otherwise go looking for any structure parameter
474+
;;Otherwise go looking for any structure parameters
396475
data param, @SmcParameter
397476
foreach param in meth.Parameters
398477
begin

CodeGenEngine/Tokenizer.dbl

+5
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,9 @@ namespace CodeGen.Engine
786786
expressions.Add("DATE_NOT_YMD", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
787787
expressions.Add("DATE_NOT_YYYYMMDD", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop | TokenValidity.ParameterLoop)
788788
expressions.Add("DATE_NULLABLE", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
789+
expressions.Add("DATE_PARAMETERS", TokenValidity.MethodLoop)
790+
expressions.Add("DATE_PARAMETERS_IN", TokenValidity.MethodLoop)
791+
expressions.Add("DATE_PARAMETERS_OUT", TokenValidity.MethodLoop)
789792
expressions.Add("DATE_PERIOD", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
790793
expressions.Add("DATE_YMD", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
791794
expressions.Add("DATE_YYJJJ", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop | TokenValidity.ParameterLoop)
@@ -1025,6 +1028,8 @@ namespace CodeGen.Engine
10251028
expressions.Add("REFERENCE", TokenValidity.ParameterLoop)
10261029
expressions.Add("RELATION", TokenValidity.FieldLoop)
10271030
expressions.Add("RELATIVE", TokenValidity.FileLoop)
1031+
expressions.Add("REPLICATION_MORE", TokenValidity.FieldLoop)
1032+
expressions.Add("REPLICATION_NOMORE", TokenValidity.FieldLoop)
10281033
expressions.Add("REPORT", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
10291034
expressions.Add("REPORT_CENTER", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)
10301035
expressions.Add("REPORT_LEFT", TokenValidity.FieldLoop | TokenValidity.KeySegmentLoop | TokenValidity.RelationSegmentLoop)

SampleRepository/CodeGen.sch

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
; SYNERGY DATA LANGUAGE OUTPUT
33
;
4-
; REPOSITORY : D:\CodeGen\SampleRepository\rpsmain.ism
5-
; : D:\CodeGen\SampleRepository\rpstext.ism
4+
; REPOSITORY : C:\DEV_SYNERGEX\CodeGen\SampleRepository\rpsmain.ism
5+
; : C:\DEV_SYNERGEX\CodeGen\SampleRepository\rpstext.ism
66
; : Version 9.1.5b
77
;
8-
; GENERATED : 03-JUN-2022, 14:58:42
9-
; : Version 12.1.1
8+
; GENERATED : 08-JUN-2023, 09:52:15
9+
; : Version 12.2.1
1010
; EXPORT OPTIONS : [ALL]
1111

1212

@@ -491,6 +491,23 @@ Field USER_DATE Type USER Size 14 Stored DATE
491491
User Type "YYYYMMDDHHMMSS"
492492
Description "User defined date YYYYMMDDHHMMSS"
493493

494+
Structure EXCLUDED_OVERLAY_TEST DBL ISAM
495+
Description "Excluded overlay test"
496+
497+
Field F1 Type ALPHA Size 10
498+
Description "f1"
499+
500+
Field F2 Type ALPHA Size 10
501+
Description "f2"
502+
503+
Field F3 Type ALPHA Size 10
504+
Description "F3"
505+
506+
Field ALLREC Type ALPHA Size 30 Overlay F1:0
507+
Description "All record data"
508+
Long Description
509+
"REPLICATOR_EXCLUDE"
510+
494511
Structure GROUP_TEST DBL ISAM
495512
Description "Structure to test GROUP functionality"
496513

SampleRepository/rpsmain.is1

0 Bytes
Binary file not shown.

SampleRepository/rpsmain.ism

0 Bytes
Binary file not shown.

SampleRepository/rpstext.is1

0 Bytes
Binary file not shown.

SampleRepository/rpstext.ism

0 Bytes
Binary file not shown.

SampleTemplates/b.tpl

+49-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
11
;//This template is for development testing. It is not shipped by the installer.
22
<CODEGEN_FILENAME><structure_name>_b.txt</CODEGEN_FILENAME>
3-
<NAMESPACE>
3+
<COUNTER_1_RESET>
44
<FIELD_LOOP>
5-
<FIELD_NAME>
6-
</FIELD_LOOP>
5+
<IF CUSTOM_NOT_REPLICATOR_EXCLUDE>
6+
<COUNTER_1_INCREMENT>
7+
<IF COUNTER_1_EQ_1>
8+
if (ok && openAndBind)
9+
begin
10+
if (%ssc_bind(a_dbchn,c1<StructureName>,<REPLICATION_REMAINING_INCLUSIVE_MAX_250>,
11+
</IF COUNTER_1_EQ_1>
12+
<IF CUSTOM_DBL_TYPE>
13+
& tmp<FieldSqlName><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
14+
<ELSE ALPHA>
15+
& <structure_name>.<field_original_name_modified><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
16+
<ELSE DECIMAL>
17+
& <structure_name>.<field_original_name_modified><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
18+
<ELSE INTEGER>
19+
& <structure_name>.<field_original_name_modified><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
20+
<ELSE DATE>
21+
& ^a(<structure_name>.<field_original_name_modified>)<IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
22+
<ELSE TIME>
23+
& tmp<FieldSqlName><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
24+
<ELSE USER AND USERTIMESTAMP>
25+
& tmp<FieldSqlName><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
26+
<ELSE USER AND NOT USERTIMESTAMP>
27+
<IF DEFINED_ASA_TIREMAX>
28+
& tmp<FieldSqlName><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
29+
<ELSE>
30+
& <structure_name>.<field_original_name_modified><IF REPLICATION_NOMORE>)==SSQL_FAILURE)<ELSE><IF COUNTER_1_LT_250>,<ELSE>)==SSQL_FAILURE)</IF COUNTER_1_LT_250></IF>
31+
</IF DEFINED_ASA_TIREMAX>
32+
</IF CUSTOM_DBL_TYPE>
33+
<IF COUNTER_1_EQ_250>
34+
begin
35+
ok = false
36+
sts = 0
37+
if (%ssc_getemsg(a_dbchn,errtxt,length,,dberror)==SSQL_FAILURE)
38+
errtxt="Failed to bind variables"
39+
end
40+
end
41+
<COUNTER_1_RESET>
42+
<ELSE NOMORE>
43+
begin
44+
ok = false
45+
sts = 0
46+
if (%ssc_getemsg(a_dbchn,errtxt,length,,dberror)==SSQL_FAILURE)
47+
errtxt="Failed to bind variables"
48+
end
49+
end
50+
</IF COUNTER_1_EQ_250>
51+
</IF CUSTOM_NOT_REPLICATOR_EXCLUDE>
52+
</FIELD_LOOP>

0 commit comments

Comments
 (0)