Revision 2149
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
623 | 623 |
|
624 | 624 |
##### Heuristic queries |
625 | 625 |
|
626 |
def try_insert(db, table, row, returning=None): |
|
627 |
'''Recovers from errors''' |
|
628 |
return insert(db, table, row, returning, recover=True) |
|
629 |
|
|
630 | 626 |
def put(db, table, row, pkey_=None, row_ct_ref=None): |
631 | 627 |
'''Recovers from errors. |
632 | 628 |
Only works under PostgreSQL (uses INSERT RETURNING). |
... | ... | |
634 | 630 |
if pkey_ == None: pkey_ = pkey(db, table, recover=True) |
635 | 631 |
|
636 | 632 |
try: |
637 |
cur = try_insert(db, table, row, pkey_)
|
|
633 |
cur = insert(db, table, row, pkey_, recover=True)
|
|
638 | 634 |
if row_ct_ref != None and cur.rowcount >= 0: |
639 | 635 |
row_ct_ref[0] += cur.rowcount |
640 | 636 |
return value(cur) |
Also available in: Unified diff
sql.py: Removed no-longer-needed try_insert()