11 | | result = self.cursor.execute(sql, params) |
12 | | stop = time() |
13 | | self.db.queries.append({ |
14 | | 'sql': sql % tuple(params), |
15 | | 'time': "%.3f" % (stop - start), |
16 | | }) |
17 | | return result |
| 11 | try: |
| 12 | return self.cursor.execute(sql, params) |
| 13 | finally: |
| 14 | stop = time() |
| 15 | self.db.queries.append({ |
| 16 | 'sql': sql % tuple([repr(param) for param in params]), |
| 17 | 'time': "%.3f" % (stop - start), |
| 18 | }) |
21 | | result = self.cursor.executemany(sql, param_list) |
22 | | stop = time() |
23 | | self.db.queries.append({ |
24 | | 'sql': 'MANY: ' + sql + ' ' + str(tuple(param_list)), |
25 | | 'time': "%.3f" % (stop - start), |
26 | | }) |
27 | | return result |
| 22 | try: |
| 23 | return self.cursor.executemany(sql, param_list) |
| 24 | finally: |
| 25 | stop = time() |
| 26 | self.db.queries.append({ |
| 27 | 'sql': 'MANY: ' + sql + ' ' + str(tuple(param_list)), |
| 28 | 'time': "%.3f" % (stop - start), |
| 29 | }) |