Project

General

Profile

« Previous | Next » 

Revision 2312

sql.py: put_table(): Require all in_table_cols to be sql_gen.Col objects

View differences:

lib/sql.py
727 727
    Only works under PostgreSQL (uses INSERT RETURNING).
728 728
    @param in_tables The main input table to select from, followed by a list of
729 729
        tables to join with it using the main input table's pkey
730
    @return sql_gen.Col Where the pkeys (from INSERT RETURNING) are made
731
        available
730
    @param mapping dict(out_table_col=in_table_col, ...)
731
        * out_table_col: sql_gen.Col|str
732
        * in_table_col: sql_gen.Col Wrap literal values in a sql_gen.NamedCode
733
    @return sql_gen.Col Where the output pkeys are made available
732 734
    '''
735
    for in_table_col in mapping.itervalues():
736
        assert isinstance(in_table_col, sql_gen.Col)
737
    
733 738
    temp_prefix = clean_name(out_table)
734 739
    pkeys_ref = [temp_prefix+'_pkeys']
735 740
    
lib/db_xml.py
180 180
                value))
181 181
        else: # value is literal value; should only be string or None
182 182
            assert util.is_str(value) or value == None
183
            row[out_col] = sql_gen.Literal(value) # value is literal value
183
            row[out_col] = sql_gen.NamedCode(out_col, value)
184 184
    
185 185
    # Insert node
186 186
    pkeys_loc = sql.put_table(db, out_table, in_tables, row, limit, start,

Also available in: Unified diff