Project

General

Profile

« Previous | Next » 

Revision 2178

sql.py: put_table(): Renamed in_joins to insert_joins and joins to select_joins for clarity

View differences:

lib/sql.py
710 710
    in_tables = in_tables[:] # don't modify input!
711 711
    in_tables0 = in_tables.pop(0) # first table is separate
712 712
    in_pkey = pkey(db, in_tables0, recover=True, table_is_esc=table_is_esc)
713
    in_joins = [in_tables0] + [(t, {in_pkey: join_using}) for t in in_tables]
713
    insert_joins = [in_tables0]+[(t, {in_pkey: join_using}) for t in in_tables]
714 714
    
715 715
    out_pkey = pkey(db, out_table, recover=True, table_is_esc=table_is_esc)
716 716
    pkeys_cols = [in_pkey, out_pkey]
717 717
    
718 718
    def mk_select_(cols):
719
        return mk_select(db, in_joins, cols, limit=limit, start=start,
719
        return mk_select(db, insert_joins, cols, limit=limit, start=start,
720 720
            table_is_esc=table_is_esc)
721 721
    
722 722
    out_pkeys_ref = ['out_pkeys_'+temp_suffix]
......
743 743
    try: insert_()
744 744
    except DuplicateKeyException, e:
745 745
        join_cols = util.dict_subset_right_join(mapping, e.cols)
746
        joins = in_joins + [(out_table, join_cols)]
747
        run_query_into(db, *mk_select(db, joins, pkeys_cols, start=0,
746
        select_joins = insert_joins + [(out_table, join_cols)]
747
        
748
        # Get pkeys of already existing rows
749
        run_query_into(db, *mk_select(db, select_joins, pkeys_cols, start=0,
748 750
            table_is_esc=table_is_esc), into_ref=pkeys_ref, recover=True)
749 751
    
750 752
    return (pkeys_ref[0], out_pkey)

Also available in: Unified diff