Revision 2575
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
9 | 9 |
|
10 | 10 |
##### Escaping |
11 | 11 |
|
12 |
def is_safe_name(name): return re.match(r'^[^\WA-Z]+$', name) # no uppercase |
|
12 |
def is_safe_name(name): |
|
13 |
'''A name is safe *and unambiguous* if it contains only lowercase word (\w) |
|
14 |
characters and doesn't start with a digit''' |
|
15 |
return re.match(r'^(?!\d)[^\WA-Z]+$', name) |
|
13 | 16 |
|
14 | 17 |
def esc_name(name, quote='"'): |
15 | 18 |
if is_safe_name(name): return name |
Also available in: Unified diff
sql_gen.py: is_safe_name(): Fixed bug where names starting with a digit were incorrectly considered safe