《Vfp编译软件(Vfp Compiler)》源代码预处理技术之二:
2、/VCDECOMPCOND=ON 分解复合条件语句
原代码:
IF x1 AND x2 AND x3 AND x4 AND x5
?"Y"
ELSE
?"N"
ENDI
IF x1 OR x2 OR x3 OR x4 OR x5
?"Y"
ELSE
?"N"
ENDI
DO CASE
CASE x1 AND x2 AND x3 AND x4 AND x5
?"Y"
OTHER
?"N"
ENDC
DO CASE
CASE x1 OR x2 OR x3 OR x4 OR x5
?"Y"
OTHER
?"N"
ENDC
“分解复合条件语句”后代码:
IF x1
IF x2
IF x3
IF x4
IF x5
?"Y"
ELSE
?"N"
ENDIF
ELSE
?"N"
ENDIF
ELSE
?"N"
ENDIF
ELSE
?"N"
ENDIF
ELSE
?"N"
ENDIF
IF x1
?"Y"
ELSE
IF x2
?"Y"
ELSE
IF x3
?"Y"
ELSE
IF x4
?"Y"
ELSE
IF x5
?"Y"
ELSE
?"N"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
DO CASE
CASE x1
DO CASE
CASE x2
DO CASE
CASE x3
DO CASE
CASE x4
DO CASE
CASE x5
?"Y"
OTHER
?"N"
ENDCASE
OTHER
?"N"
ENDCASE
OTHER
?"N"
ENDCASE
OTHER
?"N"
ENDCASE
OTHER
?"N"
ENDCASE
DO CASE
CASE x1
?"Y"
CASE x2
?"Y"
CASE x3
?"Y"
CASE x4
?"Y"
CASE x5
?"Y"
OTHER
?"N"
ENDCASE
可以验证“分解复合条件语句”后代码与原代码的功能是相同的。
------解决方案--------------------------------------------------------
- SQL code
If x1 And x2 And x3 And x4 And x5 ?"Y"Else ?"N"Endif--处理成如下后,速度和性能变化多大?If x1 If x2 If x3 If x4 If x5 ?"Y" Else ?"N" Endif Else ?"N" Endif Else ?"N" Endif Else ?"N" EndifElse ?"N"Endif