Project

General

Profile

« Previous | Next » 

Revision 2284

sql.py: mk_select(): Inline cond() and don't use sql_gen.as_Col because sql_gen.as_ValueCond.to_str() calls it

View differences:

lib/sql.py
448 448
        '''Parses fields'''
449 449
        return sql_gen.value2sql_gen(field, default_table, table_is_esc,
450 450
            assume_col=True).to_str(db)
451
    def cond(entry):
452
        '''Parses conditions'''
453
        left, right = entry
454
        return sql_gen.as_ValueCond(right).to_str(db, sql_gen.as_Col(left))
455 451
    
456 452
    query = 'SELECT'
457 453
    
......
483 479
    
484 480
    missing = True
485 481
    if conds != {}:
486
        query += ' WHERE '+(' AND '.join(map(cond, conds.iteritems())))
482
        query += ' WHERE '+(' AND '.join((sql_gen.as_ValueCond(r).to_str(db, l)
483
            for l, r in conds.iteritems())))
487 484
        params += conds.values()
488 485
        missing = False
489 486
    if order_by != None:

Also available in: Unified diff