Revision 3265
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
484 | 484 |
log_ignore_excs = tuple(log_ignore_excs) |
485 | 485 |
debug_msg_ref = [None] |
486 | 486 |
|
487 |
if db.debug and is_explainable(query): |
|
488 |
query += '\n'+sql_gen.esc_comment(' EXPLAIN:\n' |
|
489 |
+explain(db, query, log_level=log_level+1)) |
|
487 |
query = with_explain_comment(db, query, log_level=log_level+1) |
|
490 | 488 |
|
491 | 489 |
try: |
492 | 490 |
try: |
... | ... | |
554 | 552 |
# not a higher log_level because it's useful to see what query is being |
555 | 553 |
# run before it's executed, which EXPLAIN effectively provides |
556 | 554 |
|
555 |
def has_comment(query): return query.endswith('*/') |
|
556 |
|
|
557 |
def with_explain_comment(db, query, **kw_args): |
|
558 |
if db.debug and not has_comment(query) and is_explainable(query): |
|
559 |
query += '\n'+sql_gen.esc_comment(' EXPLAIN:\n' |
|
560 |
+explain(db, query, **kw_args)) |
|
561 |
return query |
|
562 |
|
|
557 | 563 |
def next_version(name): |
558 | 564 |
version = 1 # first existing name was version 0 |
559 | 565 |
match = re.match(r'^(.*)#(\d+)$', name) |
Also available in: Unified diff
sql.py: Added with_explain_comment() and use it in run_query()