Revision 2416
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
828 | 828 |
if not create: raise |
829 | 829 |
return put(db, table, row, pkey, row_ct_ref) # insert new row |
830 | 830 |
|
831 |
def put_table(db, out_table, in_tables, mapping, limit=None, start=0, |
|
832 |
row_ct_ref=None): |
|
831 |
def put_table(db, out_table, in_tables, mapping, row_ct_ref=None): |
|
833 | 832 |
'''Recovers from errors. |
834 | 833 |
Only works under PostgreSQL (uses INSERT RETURNING). |
835 | 834 |
@param in_tables The main input table to select from, followed by a list of |
... | ... | |
876 | 875 |
run_query_into(db, query, params, into=pkeys) |
877 | 876 |
pkeys_table_exists_ref[0] = True |
878 | 877 |
|
878 |
limit = None |
|
879 | 879 |
conds = set() |
880 | 880 |
distinct_on = [] |
881 | 881 |
def mk_main_select(joins, cols): |
882 | 882 |
return mk_select(db, joins, cols, conds, distinct_on, limit=limit, |
883 |
start=start)
|
|
883 |
start=0)
|
|
884 | 884 |
|
885 | 885 |
def log_exc(e): |
886 | 886 |
db.log_debug('Caught exception: '+exc.str_(e, first_line_only=True)) |
lib/db_xml.py | ||
---|---|---|
185 | 185 |
|
186 | 186 |
# Insert node |
187 | 187 |
db.log_debug('Putting columns: '+str(row)) |
188 |
pkeys_loc = sql.put_table(db, out_table, in_tables, row, limit, start, |
|
189 |
row_ct_ref=row_ct_ref) |
|
188 |
pkeys_loc = sql.put_table(db, out_table, in_tables, row, row_ct_ref) |
|
190 | 189 |
if commit: db.db.commit() |
191 | 190 |
|
192 | 191 |
# Insert children with fkeys to parent |
Also available in: Unified diff
sql.py: put_table(): Removed limit and start params because they were never fully implemented, and because it's simpler to just have the caller subset their input table