Revision 3238
Added by Aaron Marcuse-Kubitza over 12 years ago
sql.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import copy |
4 | 4 |
import re |
5 |
import time |
|
5 | 6 |
import warnings |
6 | 7 |
|
7 | 8 |
import exc |
... | ... | |
367 | 368 |
try: |
368 | 369 |
# Get cursor |
369 | 370 |
if cacheable: |
370 |
try: |
|
371 |
cur = self.query_results[query] |
|
372 |
used_cache = True |
|
371 |
try: cur = self.query_results[query] |
|
373 | 372 |
except KeyError: cur = self.DbCursor(self) |
373 |
else: used_cache = True |
|
374 | 374 |
else: cur = self.db.cursor() |
375 | 375 |
|
376 | 376 |
# Run query |
377 |
try: |
|
378 |
cur.execute(query) |
|
379 |
self.do_autocommit() |
|
377 |
try: cur.execute(query) |
|
380 | 378 |
except Exception, e: |
381 | 379 |
_add_cursor_info(e, self, query) |
382 | 380 |
raise |
381 |
else: self.do_autocommit() |
|
383 | 382 |
finally: |
384 | 383 |
self.print_notices() |
385 | 384 |
if self.debug: # log or return query |
Also available in: Unified diff
sql.py: DbConn.run_query(): Use else blocks to avoid applying exception handling to commands run after the main command