Ticket #5415: 5415.diff

File 5415.diff, 1.2 KB (added by czhang, 8 years ago)

I tried to come up this simple patch, but I have no idea how to test this properly.

  • django/db/backends/util.py

     
    11import datetime
    22import md5
    33from time import time
     4from django.core import signals
     5from django.dispatch import dispatcher
    46from django.utils.encoding import smart_unicode, force_unicode
    57
    68try:
     
    1517
    1618    def execute(self, sql, params=()):
    1719        start = time()
     20        dispatcher.send(signal=signals.dbapi_sql_execute, sender=self, sql=sql, params=params)
    1821        try:
    1922            return self.cursor.execute(sql, params)
    2023        finally:
     
    2629
    2730    def executemany(self, sql, param_list):
    2831        start = time()
     32        dispatcher.send(signal=signals.dbapi_sql_execute, sender=self, sql=sql, params=params_list)
    2933        try:
    3034            return self.cursor.executemany(sql, param_list)
    3135        finally:
  • django/core/signals.py

     
    11request_started = object()
    22request_finished = object()
    33got_request_exception = object()
     4dbapi_sql_execute = object()
Back to Top