Project

General

Profile

« Previous | Next » 

Revision 2323

sql_gen.py: Renamed NamedCode to NamedCol to better reflect its specific use

View differences:

lib/sql_gen.py
60 60
    if col == None or isinstance(col, Code): return col
61 61
    else: return Col(col, table)
62 62

  
63
class NamedCode(Col):
63
class NamedCol(Col):
64 64
    def __init__(self, name, code):
65 65
        Col.__init__(self, name)
66 66
        
......
78 78
class ValueCond:
79 79
    def __init__(self, value):
80 80
        if not isinstance(value, Code): value = Literal(value)
81
        if isinstance(value, NamedCode): value = value.code
81
        if isinstance(value, NamedCol): value = value.code
82 82
        
83 83
        self.value = value
84 84
    
lib/sql.py
721 721
        tables to join with it using the main input table's pkey
722 722
    @param mapping dict(out_table_col=in_table_col, ...)
723 723
        * out_table_col: sql_gen.Col|str
724
        * in_table_col: sql_gen.Col Wrap literal values in a sql_gen.NamedCode
724
        * in_table_col: sql_gen.Col Wrap literal values in a sql_gen.NamedCol
725 725
    @return sql_gen.Col Where the output pkeys are made available
726 726
    '''
727 727
    for in_table_col in mapping.itervalues():
......
802 802
            except KeyError: # no mapping for missing col, so every row invalid
803 803
                db.log_debug('Missing mapping for '+out_col)
804 804
                run_query_into_pkeys(*mk_select(db, insert_joins,
805
                    [in_pkey_col, sql_gen.NamedCode(out_pkey, None)], start=0))
805
                    [in_pkey_col, sql_gen.NamedCol(out_pkey, None)], start=0))
806 806
                break
807 807
            else:
808 808
                log_ignore(in_col, 'NULL')
lib/db_xml.py
181 181
                value), in_table)
182 182
        else: # value is literal value; should only be string or None
183 183
            assert util.is_str(value) or value == None
184
            row[out_col] = sql_gen.NamedCode(out_col, value)
184
            row[out_col] = sql_gen.NamedCol(out_col, value)
185 185
    
186 186
    # Insert node
187 187
    pkeys_loc = sql.put_table(db, out_table, in_tables, row, limit, start,

Also available in: Unified diff