Project

General

Profile

« Previous | Next » 

Revision 2073

sql.py: mk_insert_select(): Document that embeddable will cause the query to be fully cached, not just if it raises an exception. insert_select(): into != None: Pass recover and cacheable through to each run_query()

View differences:

sql.py
350 350
    '''
351 351
    @param returning str|None An inserted column (such as pkey) to return
352 352
    @param embeddable Whether the query should be embeddable as a nested SELECT.
353
        If you set this, you must ensure cacheable=False when the query is run.
353
        Warning: If you set this and cacheable=True when the query is run, the
354
        query will be fully cached, not just if it raises an exception.
354 355
    @param table_is_esc Whether the table name has already been escaped
355 356
    '''
356 357
    if select_query == None: select_query = 'DEFAULT VALUES'
......
397 398
    if into == None: # return RETURNING values
398 399
        return run_query(db, query, params, recover, cacheable)
399 400
    else: # place RETURNING values in temp table
400
        run_query(db, 'DROP TABLE IF EXISTS '+into+' CASCADE')
401
        return run_query(db, 'CREATE TEMP TABLE '+into+' AS '+query, params)
402
            # CREATE TABLE returns SELECT tag with rowcount = # inserts
401
        run_query(db, 'DROP TABLE IF EXISTS '+into+' CASCADE', recover)
402
        return run_query(db, 'CREATE TEMP TABLE '+into+' AS '+query, params,
403
            recover, cacheable) # CREATE TABLE sets rowcount to # inserts
403 404

  
404 405
default = object() # tells insert() to use the default value for a column
405 406

  

Also available in: Unified diff