Revision 2152
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
475 | 475 |
|
476 | 476 |
def insert_select(db, *args, **kw_args): |
477 | 477 |
'''For params, see mk_insert_select() and run_query_into() |
478 |
@param into Name of temp table to place RETURNING values in
|
|
478 |
@param into_ref List with name of temp table to place RETURNING values in
|
|
479 | 479 |
''' |
480 | 480 |
into_ref = kw_args.pop('into_ref', None) |
481 | 481 |
if into_ref != None: kw_args['embeddable'] = True |
... | ... | |
689 | 689 |
# Join together out_pkeys and in_pkeys |
690 | 690 |
run_query_into(db, *mk_select(db, |
691 | 691 |
[in_pkeys, (out_pkeys, {row_num_col: join_using})], |
692 |
pkeys_cols, start=0), into=[pkeys]) |
|
692 |
pkeys_cols, start=0), into_ref=[pkeys])
|
|
693 | 693 |
|
694 | 694 |
# Do inserts and selects |
695 | 695 |
try: insert_() |
... | ... | |
697 | 697 |
join_cols = util.dict_subset_right_join(mapping, e.cols) |
698 | 698 |
joins = in_joins + [(out_table, join_cols)] |
699 | 699 |
run_query_into(db, *mk_select(db, joins, pkeys_cols, |
700 |
table_is_esc=table_is_esc), into=[pkeys], recover=True) |
|
700 |
table_is_esc=table_is_esc), into_ref=[pkeys], recover=True)
|
|
701 | 701 |
|
702 | 702 |
return (pkeys, out_pkey) |
703 | 703 |
|
Also available in: Unified diff
sql.py: run_query_into(): Made into param a reference so that the function can change it, and renamed it to into_ref