diff options
author | Marko Kreen | 2008-03-11 16:17:07 +0000 |
---|---|---|
committer | Marko Kreen | 2008-03-11 16:17:07 +0000 |
commit | f06eecab93dd29b8a4d1064732b39da4b16c2ce0 (patch) | |
tree | 14a0328403495fd8c66b88ab5bbd7522cec89125 /python/skytools/quoting.py | |
parent | d8119d54d3d79b5a01ece87e59e988099bd646d6 (diff) |
unquote_ident() + unquote_literal()
Diffstat (limited to 'python/skytools/quoting.py')
-rw-r--r-- | python/skytools/quoting.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/python/skytools/quoting.py b/python/skytools/quoting.py index 19854a5f..10492b37 100644 --- a/python/skytools/quoting.py +++ b/python/skytools/quoting.py @@ -9,7 +9,8 @@ __all__ = [ "db_urlencode", "db_urldecode", "unescape", "quote_bytea_literal", "quote_bytea_copy", "quote_statement", - "quote_ident", "quote_fqident", "quote_json", "unescape_copy" + "quote_ident", "quote_fqident", "quote_json", "unescape_copy", + "unquote_ident", "unquote_literal", ] try: @@ -105,3 +106,9 @@ def unescape_copy(val): return None return unescape(val) +def unquote_sql_ident(val): + """Unquotes possibly quoted SQL identifier.""" + if val[0] == '"' and val[-1] == '"': + return val[1:-1].replace('""', '"') + return val + |