Revision 3320
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
44 | 44 |
return quote + name.replace(quote, quote+quote) + quote |
45 | 45 |
# doubling an embedded quote escapes it in both PostgreSQL and MySQL |
46 | 46 |
|
47 |
def unesc_name(name, quote='"'): |
|
48 |
removed_ref = [False] |
|
49 |
name = strings.remove_prefix(quote, name, removed_ref) |
|
50 |
if removed_ref[0]: |
|
51 |
name = strings.remove_suffix(quote, name, removed_ref) |
|
52 |
assert removed_ref[0] |
|
53 |
name = name.replace(quote+quote, quote) |
|
54 |
return name |
|
55 |
|
|
47 | 56 |
def clean_name(name): return name.replace('"', '').replace('`', '') |
48 | 57 |
|
49 | 58 |
def esc_comment(comment): return '/*'+comment.replace('*/', '* /')+'*/' |
Also available in: Unified diff
sql_gen.py: Added unesc_name()