Allow to specify the number of arguments in the qtIdent to make it work

with schema specified object name. This will also works with
EntepriseDB's package too.

Also, added dependency on the current connection object, it will allow
us to use the keywords list specific to the database server in futuer.

You can use the qtIdent template filter as:
conn|qtIdent(name)
or,
conn|qtIdent(schema_name, name)
pull/3/head
Ashesh Vashi 2016-01-04 13:13:27 +05:30
parent 613be3b6fe
commit 1ba5d79978
1 changed files with 15 additions and 9 deletions

View File

@ -859,16 +859,22 @@ class Driver(BaseDriver):
return result
@staticmethod
def qtIdent(value):
def qtIdent(conn, *args):
# We're not using the conn object at the moment, but - we will modify the
# logic to use the server version specific keywords later.
res = None
value = None
if (len(value) == 0):
return value
for val in args:
if len(val) == 0:
continue
result = value;
value = val
if (Driver.needsQuoting(result, False)):
result.replace("\"", "\"\"")
return "\"" + result + "\""
else:
return result;
if (Driver.needsQuoting(val, False)):
value.replace("\"", "\"\"")
value = "\"" + value + "\""
res = ((res and res + '.') or '') + value
return res