Project

General

Profile

« Previous | Next » 

Revision 2410

sql.py mk_select(), sql_gen.py Join.to_str(): Fixed bug where conditions needed to be wrapped in () before being AND-ed together to ensure the proper operator precedence

View differences:

lib/sql_gen.py
244 244
                right = CompareCond(as_Col(left, right_table), '~=')
245 245
            
246 246
            right = as_ValueCond(right, right_table)
247
            return right.to_str(db, as_Col(left, left_table))
247
            return '('+right.to_str(db, as_Col(left, left_table))+')'
248 248
        
249 249
        # Create join condition
250 250
        type_ = self.type_
lib/sql.py
485 485
    
486 486
    missing = True
487 487
    if conds != []:
488
        query += ' WHERE '+(' AND '.join((sql_gen.ColValueCond(l, r).to_str(db)
489
            for l, r in conds)))
488
        query += ' WHERE '+(' AND '.join(('('+sql_gen.ColValueCond(l, r)
489
            .to_str(db)+')' for l, r in conds)))
490 490
        missing = False
491 491
    if order_by != None:
492 492
        query += ' ORDER BY '+sql_gen.as_Col(order_by, table0).to_str(db)

Also available in: Unified diff