Project

General

Profile

« Previous | Next » 

Revision 10840

lib/sql_gen.py: ColValueCond: support conds that are just plain SQL (without separate left and right sides) using special custom_cond flag value

View differences:

sql_gen.py
809 809
    
810 810
    def to_str(self, db): return 'NOT '+self.cond.to_str(db)
811 811

  
812
custom_cond = object() # tells ColValueCond that value is a plain SQL cond
813

  
812 814
class ColValueCond(Code):
813 815
    def __init__(self, col, value):
814 816
        Code.__init__(self)
815 817
        
816
        value = as_ValueCond(value)
818
        if col is not custom_cond: value = as_ValueCond(value)
817 819
        
818 820
        self.col = col
819 821
        self.value = value
820 822
    
821
    def to_str(self, db): return self.value.to_str(db, self.col)
823
    def to_str(self, db):
824
        if self.col is custom_cond: return self.value.to_str(db)
825
        else: return self.value.to_str(db, self.col)
822 826

  
823 827
def combine_conds(conds, keyword=None):
824 828
    '''

Also available in: Unified diff