Project

General

Profile

« Previous | Next » 

Revision 2318

sql.py: mk_insert_select(): Fixed bug where utput column names were not being escaped

View differences:

sql.py
505 505
        Warning: If you set this and cacheable=True when the query is run, the
506 506
        query will be fully cached, not just if it raises an exception.
507 507
    '''
508
    table = sql_gen.as_Table(table).to_str(db)
509
    if cols == []: cols = None # no cols (all defaults) = unknown col names
510
    if cols != None: cols = [sql_gen.as_Col(v).to_str(db) for v in cols]
508 511
    if select_query == None: select_query = 'DEFAULT VALUES'
509
    if cols == []: cols = None # no cols (all defaults) = unknown col names
510
    table = sql_gen.as_Table(table).to_str(db)
511 512
    
512 513
    # Build query
513 514
    query = 'INSERT INTO '+table
514
    if cols != None:
515
        map(check_name, cols)
516
        query += ' ('+', '.join(cols)+')'
515
    if cols != None: query += ' ('+', '.join(cols)+')'
517 516
    query += ' '+select_query
518 517
    
519 518
    if returning != None:

Also available in: Unified diff