Revision 2791
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
396 | 396 |
|
397 | 397 |
def with_savepoint(db, func): return db.with_savepoint(func) |
398 | 398 |
|
399 |
def run_query(db, query, params=None, recover=None, cacheable=False,
|
|
400 |
log_level=2, log_ignore_excs=None, **kw_args):
|
|
399 |
def run_query(db, query, recover=None, cacheable=False, log_level=2,
|
|
400 |
log_ignore_excs=None, **kw_args): |
|
401 | 401 |
'''For params, see run_raw_query()''' |
402 | 402 |
if recover == None: recover = False |
403 | 403 |
if log_ignore_excs == None: log_ignore_excs = () |
... | ... | |
409 | 409 |
|
410 | 410 |
try: |
411 | 411 |
try: |
412 |
def run(): return run_raw_query(db, query, params, cacheable,
|
|
412 |
def run(): return run_raw_query(db, query, [], cacheable,
|
|
413 | 413 |
log_level, debug_msg_ref, **kw_args) |
414 |
if recover and not db.is_cached(query, params):
|
|
414 |
if recover and not db.is_cached(query, []):
|
|
415 | 415 |
return with_savepoint(db, run) |
416 | 416 |
else: return run() # don't need savepoint if cached |
417 | 417 |
except Exception, e: |
... | ... | |
591 | 591 |
cacheable = kw_args.pop('cacheable', True) |
592 | 592 |
log_level = kw_args.pop('log_level', 2) |
593 | 593 |
|
594 |
return run_query(db, mk_select(db, *args, **kw_args), [], recover,
|
|
595 |
cacheable, log_level=log_level)
|
|
594 |
return run_query(db, mk_select(db, *args, **kw_args), recover, cacheable,
|
|
595 |
log_level=log_level) |
|
596 | 596 |
|
597 | 597 |
def mk_insert_select(db, table, cols=None, select_query=None, returning=None, |
598 | 598 |
embeddable=False): |
... | ... | |
699 | 699 |
'''For params, see mk_update() and run_query()''' |
700 | 700 |
recover = kw_args.pop('recover', None) |
701 | 701 |
|
702 |
return run_query(db, mk_update(db, *args, **kw_args), [], recover)
|
|
702 |
return run_query(db, mk_update(db, *args, **kw_args), recover) |
|
703 | 703 |
|
704 | 704 |
def last_insert_id(db): |
705 | 705 |
module = util.root_module(db.db) |
Also available in: Unified diff
sql.py: run_query(): Removed no longer used params parameter