Project

General

Profile

« Previous | Next » 

Revision 2157

sql.py: mk_select(): fields: Support columns with tables. Changed syntax for literal values so that it wouldn't conflict with new syntax for columns with tables.

View differences:

sql.py
382 382
    
383 383
    def parse_col(field):
384 384
        '''Parses fields'''
385
        if isinstance(field, tuple): # field is literal value
386
            value, col = field
385
        is_tuple = isinstance(field, tuple)
386
        if is_tuple and len(field) == 1: # field is literal value
387
            value, = field
387 388
            sql_ = '%s'
388 389
            params.append(value)
389
            if col != None: sql_ += ' AS '+esc_name_(col)
390
        elif is_tuple and len(field) == 2: # field is col with table
391
            table, col = field
392
            if not table_is_esc: table = esc_name_(table)
393
            sql_ = table+'.'+esc_name_(col)
390 394
        else: sql_ = esc_name_(field) # field is col name
391 395
        return sql_
392 396
    def cond(entry):
......
672 676
        available
673 677
    '''
674 678
    temp_prefix = '_'.join(map(clean_name,
675
        [out_table] + list(iters.flatten(mapping.items()))))
679
        [out_table] + list(iters.flatten_n(mapping.items(), depth=3))))
676 680
    pkeys_ref = [temp_prefix+'_pkeys']
677 681
    
678 682
    # Join together input tables

Also available in: Unified diff