def execute(self, sql, parameters=DEFAULT): transaction = current_transaction() if parameters is not DEFAULT: with DatabaseTrace(transaction, sql, self._nr_dbapi2_module, self._nr_connect_params, None, parameters): return self.__wrapped__.execute(sql, parameters) else: with DatabaseTrace(transaction, sql, self._nr_dbapi2_module, self._nr_connect_params): return self.__wrapped__.execute(sql)
def __exit__(self, exc, value, tb): transaction = current_transaction() name = callable_name(self.__wrapped__.__exit__) with FunctionTrace(transaction, name): if exc is None and value is None and tb is None: with DatabaseTrace(transaction, 'COMMIT', self._nr_dbapi2_module): return self.__wrapped__.__exit__(exc, value, tb) else: with DatabaseTrace(transaction, 'ROLLBACK', self._nr_dbapi2_module): return self.__wrapped__.__exit__(exc, value, tb)
def executemany(self, sql, seq_of_parameters): transaction = current_transaction() try: parameters = seq_of_parameters[0] except (TypeError, IndexError): parameters = DEFAULT if parameters is not DEFAULT: with DatabaseTrace(transaction, sql, self._nr_dbapi2_module, self._nr_connect_params, self._nr_cursor_params, parameters): return self.__wrapped__.executemany(sql, seq_of_parameters) else: with DatabaseTrace(transaction, sql, self._nr_dbapi2_module, self._nr_connect_params, self._nr_cursor_params): return self.__wrapped__.executemany(sql, seq_of_parameters)
def callproc(self, procname, parameters=DEFAULT): transaction = current_transaction() with DatabaseTrace(transaction, 'CALL %s' % procname, self._nr_dbapi2_module): if parameters is not DEFAULT: return self.__wrapped__.callproc(procname, parameters) else: return self.__wrapped__.callproc(procname)
def executescript(self, sql_script): transaction = current_transaction() with DatabaseTrace(transaction, sql_script, self._nr_dbapi2_module): return self.__wrapped__.executescript(sql_script)
def executemany(self, sql, seq_of_parameters): transaction = current_transaction() with DatabaseTrace(transaction, sql, self._nr_dbapi2_module, self._nr_connect_params, None, list(seq_of_parameters)[0]): return self.__wrapped__.executemany(sql, seq_of_parameters)
def rollback(self): transaction = current_transaction() with DatabaseTrace(transaction, 'ROLLBACK', self._nr_dbapi2_module): return self.__wrapped__.rollback()
def commit(self): transaction = current_transaction() with DatabaseTrace(transaction, 'COMMIT', self._nr_dbapi2_module): return self.__wrapped__.commit()