Add debug tracing of SQL execution

Add a 'setTrace' function which can be used to enable/disable debug
tracing of executed SQL statements.