FOR EACH loan WHERE /* Condition1 */ loan.date = SomeDate
AND /* Condition2 */ loan.type = SomeType
AND /* Condition3 */ (IF SpecMode THEN TRUE ELSE loan.spec = SomeSpec)
Condition3 = TRUE when SpecMode = TRUE. So I wonder if code above and code below would work exact the same (incl. speed) when SpecMode = TRUE?
FOR EACH loan WHERE Condition1
AND Condition2
AND TRUE
Or even like this?
FOR EACH loan WHERE Condition1
AND Condition2
Generally speaking question is how Progress manages conditions which can be evaluated regardless of database records. Does it take more time? Also links about how Progress works in more deep view would be appreciated.
Add 08/16/13: Code I'm working with initially was:
IF SpecMode THEN
FOR EACH loan WHERE Condition1 AND Condition2:
RUN Proc.
ELSE
FOR EACH loan WHERE Condition1 AND Condition2 AND Condition3:
RUN Proc.
Dynamic queries was first idea came to my mind, but I realized that it mean rewriting of all nested code with dynamic queries style (which is imo has worse readabilty, I moved this to separate question). I want to go with modern approach so I will do it if it's most reasonable solution.
There is third way which keeps code in "static style". It is using include files with parameters. But it means another .i
file in already huge codebase. And I generally hate this approach (as well as "cheating" with preprocessor constants containing code). Our system is big and old and full of this kind of things, which is harder to analyze and basically seems to be just not right.