Project

General

Profile

« Previous | Next » 

Revision 3185

sql.py: mk_select(): Replaced newlines with spaces when query is simple enough to fit on one line

View differences:

lib/sql.py
625 625
            query += ' ON ('+(', '.join(map(parse_col, distinct_on)))+')'
626 626
    
627 627
    # Columns
628
    if fields == None:
629
        if query.find('\n') >= 0: whitespace = '\n'
630
        else: whitespace = ' '
631
        query += whitespace+'*'
628
    if query.find('\n') >= 0: whitespace = '\n'
629
    else: whitespace = ' '
630
    if fields == None: query += whitespace+'*'
632 631
    else:
633 632
        assert fields != []
634
        query += '\n'+('\n, '.join(map(parse_col, fields)))
633
        if len(fields) > 1: whitespace = '\n'
634
        query += whitespace+('\n, '.join(map(parse_col, fields)))
635 635
    
636 636
    # Main table
637
    query += '\nFROM '+table0.to_str(db)
637
    if query.find('\n') >= 0 or len(tables) > 0: whitespace = '\n'
638
    else: whitespace = ' '
639
    query += whitespace+'FROM '+table0.to_str(db)
638 640
    
639 641
    # Add joins
640 642
    left_table = table0

Also available in: Unified diff