Ticket #5001: query-log.diff
File query-log.diff, 1.0 KB (added by , 17 years ago) |
---|
-
db/backends/util.py
13 13 self.cursor = cursor 14 14 self.db = db 15 15 16 try: 17 from django.conf import settings 18 self.debug_query = settings.DEBUG_QUERY 19 except AttributeError: 20 self.debug_query = False 21 16 22 def execute(self, sql, params=()): 17 23 start = time() 18 24 try: … … 24 30 'time': "%.3f" % (stop - start), 25 31 }) 26 32 33 if self.debug_query: 34 print 'QUERY:', self.db.queries[-1]['sql'] 35 27 36 def executemany(self, sql, param_list): 28 37 start = time() 29 38 try: … … 35 44 'time': "%.3f" % (stop - start), 36 45 }) 37 46 47 if self.debug_query: 48 print 'QUERY:', self.db.queries[-1]['sql'] 49 38 50 def __getattr__(self, attr): 39 51 if attr in self.__dict__: 40 52 return self.__dict__[attr]