Revision 5349
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql.py | ||
---|---|---|
12 | 12 |
import profiling |
13 | 13 |
from Proxy import Proxy |
14 | 14 |
import rand |
15 |
import regexp |
|
15 | 16 |
import sql_gen |
16 | 17 |
import strings |
17 | 18 |
import util |
... | ... | |
1034 | 1035 |
expr = expr.replace('(NULL IS NULL)', 'true') |
1035 | 1036 |
expr = expr.replace('(NULL IS NOT NULL)', 'false') |
1036 | 1037 |
expr = re.sub(logic_op_re('OR', bool_re), r'', expr) |
1037 |
while True: |
|
1038 |
expr, n = re.subn(r'\((\([^()]*\))\)', r'\1', expr) |
|
1039 |
if n == 0: break |
|
1038 |
expr = regexp.sub_nested(r'\((\([^()]*\))\)', r'\1', expr) |
|
1040 | 1039 |
return expr |
1041 | 1040 |
|
1042 | 1041 |
name_re = r'(?:\w+|(?:"[^"]*")+)' |
Also available in: Unified diff
sql.py: simplify_expr(): Use new regexp.sub_nested()