OracleDB: Add format_param method

This commit is contained in:
Benjamin Renard 2021-11-18 19:21:43 +01:00
parent 6c7f3e4871
commit f8225bfbc9

View file

@ -165,6 +165,10 @@ class OracleDB:
# SQL helpers
#
@staticmethod
def format_param(param):
return ':{0}'.format(param)
@classmethod
def _combine_params(cls, params, to_add=None, **kwargs):
if to_add:
@ -226,7 +230,7 @@ class OracleDB:
idx += 1
cls._combine_params(params, {param: value})
sql_where_clauses.append(
'"{field}" = :{param}'.format(field=field, param=param)
'"{field}" = {param}'.format(field=field, param=cls.format_param(param))
)
return (
(" %s " % where_op).join(sql_where_clauses),
@ -267,7 +271,7 @@ class OracleDB:
self._quote_table_name(table),
'", "'.join(values.keys()),
", ".join([
':{0}'.format(key)
self.format_param(key)
for key in values
])
)
@ -287,7 +291,7 @@ class OracleDB:
sql = 'UPDATE {0} SET {1}'.format(
self._quote_table_name(table),
", ".join([
'"{0}" = :{0}'.format(key)
'"{0}" = {1}'.format(key, self.format_param(key))
for key in values
])
)