Project

General

Profile

« Previous | Next » 

Revision 3237

sql.py: DbConn.run_query(): Always output or return the log message after the query is run, so that it can be output with profiling statistics in the log message header

View differences:

lib/sql.py
373 373
                except KeyError: cur = self.DbCursor(self)
374 374
            else: cur = self.db.cursor()
375 375
            
376
            # Log query
377
            if self.debug and debug_msg_ref == None: # log before running
378
                self.log_debug(log_msg(query), log_level)
379
            
380 376
            # Run query
381 377
            try:
382 378
                cur.execute(query)
......
386 382
                raise
387 383
        finally:
388 384
            self.print_notices()
389
            if self.debug and debug_msg_ref != None: # return after running
390
                debug_msg_ref[0] = log_msg(str(get_cur_query(cur, query)))
385
            if self.debug: # log or return query
386
                msg = log_msg(str(get_cur_query(cur, query)))
387
                if debug_msg_ref != None: debug_msg_ref[0] = msg
388
                else: self.log_debug(msg, log_level)
391 389
        
392 390
        return cur
393 391
    

Also available in: Unified diff