Project

General

Profile

« Previous | Next » 

Revision 5356

sql.py: simplify_expr(): Use new simplify_recursive(). This also fixes a bug where some logic expressions are not simplified because of extra parens.

View differences:

lib/sql.py
1044 1044
def simplify_expr(expr):
1045 1045
    expr = expr.replace('(NULL IS NULL)', 'true')
1046 1046
    expr = expr.replace('(NULL IS NOT NULL)', 'false')
1047
    expr = re.sub(logic_op_re('OR', bool_re), r'', expr)
1047
    expr = simplify_recursive(
1048
        lambda s: re.subn(logic_op_re('OR', bool_re), r'', s), expr)
1048 1049
    expr = simplify_parens(expr)
1049 1050
    return expr
1050 1051

  

Also available in: Unified diff