Project

General

Profile

« Previous | Next » 

Revision 2533

sql_gen.py: Added wrap_in_func()

View differences:

lib/sql_gen.py
163 163
    
164 164
    def __repr__(self): return self.to_str(mockDb, '<args>')
165 165

  
166
def wrap_in_func(function, value):
167
    '''Wraps a value inside a function call.
168
    Propagates any column renaming to the returned value.
169
    '''
170
    name = None
171
    if isinstance(value, NamedCol): name = value.name
172
    value = FunctionCall(function, value)
173
    if name != None: value = NamedCol(name, value)
174
    return value
175

  
166 176
##### Conditions
167 177

  
168 178
class ColValueCond(Code):

Also available in: Unified diff