Project

General

Profile

« Previous | Next » 

Revision 3530

sql_io.py: put_table(): After main loop: If is_literals, return immediately to avoid needing to test for is_literals in all the code that follows (which only applies to the normal case)

View differences:

lib/sql_io.py
556 556
    if cur != None and row_ct_ref != None and cur.rowcount >= 0:
557 557
        row_ct_ref[0] += cur.rowcount
558 558
    
559
    if is_literals_or_function: pass # pkeys table already created
559
    if is_literals: return sql.value(cur)
560
    
561
    if is_function: pass # pkeys table already created
560 562
    elif has_joins:
561 563
        select_joins = input_joins+[sql_gen.Join(out_table, join_cols)]
562 564
        log_debug('Getting output table pkeys of existing/inserted rows')
......
582 584
        
583 585
        sql.empty_temp(db, [insert_out_pkeys, insert_in_pkeys])
584 586
    
585
    if not is_literals_or_function:
587
    if not is_function:
586 588
        log_debug('Setting pkeys of missing rows to '
587 589
            +strings.as_tt(repr(default)))
588 590
        missing_rows_joins = [full_in_table, sql_gen.Join(into,
......
593 595
            sql_gen.NamedCol(out_pkey, default)])
594 596
    # otherwise, there is already an entry for every row
595 597
    
596
    if is_literals: return sql.value(cur)
597
    else:
598
        assert (sql.table_row_count(db, into)
599
            == sql.table_row_count(db, full_in_table))
600
        
601
        sql.empty_temp(db, insert_in_tables+[full_in_table])
602
        
603
        srcs = []
604
        if is_func: srcs = sql_gen.cols_srcs(in_cols)
605
        return sql_gen.Col(out_pkey, into, srcs)
598
    assert (sql.table_row_count(db, into)
599
        == sql.table_row_count(db, full_in_table))
600
    
601
    sql.empty_temp(db, insert_in_tables+[full_in_table])
602
    
603
    srcs = []
604
    if is_func: srcs = sql_gen.cols_srcs(in_cols)
605
    return sql_gen.Col(out_pkey, into, srcs)

Also available in: Unified diff