Actual SQL statement after bind variables specified
- by bioffe
I am trying to log every SQL statement executed from my scripts. However I contemplate one problem I can not overcome.
Is there a way to compute actual SQL statement after bind variables were specified. In SQLite I had to compute the statement to be executed manually, using code below:
def __sql_to_str__(self, value,args):
for p in args:
if type(p) is IntType or p is None:
value = value.replace("?", str(p) ,1)
else:
value = value.replace("?",'\'' + p + '\'',1)
return value
It seems CX_Oracle has cursor.parse() facilities. But I can't figure out how to trick CX_Oracle to compute my query before its execution.