Project

General

Profile

« Previous | Next » 

Revision 3619

sql_io.py: put_table(): Use is_function where caller-provided is_func was used, since is_function determines whether something is a function based on whether it actually exists as a SQL function instead of just whether its name starts with "_". Removed now-unneeded is_func param.

View differences:

lib/db_xml.py
258 258
    
259 259
    # Insert node
260 260
    pkeys_loc = sql_io.put_table(db, out_table, in_tables, row, row_ins_ct_ref,
261
        None, next, col_defaults, is_func, on_error)
261
        None, next, col_defaults, on_error)
262 262
    
263 263
    sql.empty_temp(db, set(in_tables) - no_empty)
264 264
    
lib/sql_io.py
242 242
    return str_
243 243

  
244 244
def put_table(db, out_table, in_tables, mapping, row_ct_ref=None, into=None,
245
    default=None, col_defaults={}, is_func=False, on_error=exc.raise_):
245
    default=None, col_defaults={}, on_error=exc.raise_):
246 246
    '''Recovers from errors.
247 247
    Only works under PostgreSQL (uses INSERT RETURNING).
248 248
    IMPORTANT: Must be run at the *beginning* of a transaction.
......
256 256
    @param default The *output* column to use as the pkey for missing rows.
257 257
        If this output column does not exist in the mapping, uses None.
258 258
    @param col_defaults Default values for required columns.
259
    @param is_func Whether out_table is the name of a SQL function, not a table
260 259
    @return sql_gen.Col Where the output pkeys are made available
261 260
    '''
262 261
    import psycopg2.extensions
......
301 300
    
302 301
    if not is_literals:
303 302
        if into == None:
304
            into = into_table_name(out_table, in_tables0, mapping, is_func)
303
            into = into_table_name(out_table, in_tables0, mapping, is_function)
305 304
        into = sql_gen.as_Table(into)
306 305
        
307 306
        # Set column sources
......
618 617
    sql.empty_temp(db, insert_in_tables+[full_in_table])
619 618
    
620 619
    srcs = []
621
    if is_func: srcs = sql_gen.cols_srcs(in_cols)
620
    if is_function: srcs = sql_gen.cols_srcs(in_cols)
622 621
    return sql_gen.Col(out_pkey, into, srcs)

Also available in: Unified diff