Project

General

Profile

« Previous | Next » 

Revision 2271

sql.py: mk_select(): Accept main tables (table0's) that are Table objects. This change requires plain SQL code to be wrapped in a CustomCode object if it should not be unescaped and converted to a Table object.

View differences:

sql.py
445 445
    assert start == None or type(start) == int
446 446
    if order_by is order_by_pkey:
447 447
        order_by = pkey(db, table0, recover=True, table_is_esc=table_is_esc)
448
    if not table_is_esc: table0 = esc_name_(table0)
448
    table0 = sql_gen.table2sql_gen(table0, table_is_esc)
449 449
    
450 450
    params = []
451 451
    
......
472 472
    else: query += ', '.join(map(parse_col, fields))
473 473
    
474 474
    # Main table
475
    query += ' FROM '+table0
475
    query += ' FROM '+table0.to_str(db)
476 476
    
477 477
    # Add joins
478 478
    tables = [sql_gen.join2sql_gen(v, table_is_esc) for v in tables]
479
    left_table = sql_gen.table2sql_gen(table0, table_is_esc)
479
    left_table = table0
480 480
    for join_ in tables:
481 481
        table = join_.table
482 482
        joins = join_.mapping
......
583 583
                # try again with next version of name
584 584
        
585 585
        # Return query that uses function
586
        return mk_select(db, function+'() AS f ('+returning+')', start=0,
587
            order_by=None, table_is_esc=True)# AS clause requires function alias
586
        return mk_select(db, sql_gen.CustomCode(function+'() AS f ('+returning
587
            +')'), start=0, order_by=None) # AS clause requires function alias
588 588
    
589 589
    return (query, params)
590 590

  

Also available in: Unified diff