Project

General

Profile

« Previous | Next » 

Revision 5350

sql.py: Added simplify_parens()

View differences:

lib/sql.py
1031 1031
    op_re = ' '+op+' '
1032 1032
    return '(?:'+op_re+value_re+'|'+value_re+op_re+')'
1033 1033

  
1034
def simplify_parens(expr):
1035
    return regexp.sub_nested(r'\((\([^()]*\))\)', r'\1', expr)
1036

  
1034 1037
def simplify_expr(expr):
1035 1038
    expr = expr.replace('(NULL IS NULL)', 'true')
1036 1039
    expr = expr.replace('(NULL IS NOT NULL)', 'false')

Also available in: Unified diff