Revision 2524
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
142 | 142 |
if isinstance(col, NamedCol): col = col.code |
143 | 143 |
return col |
144 | 144 |
|
145 |
##### Functions |
|
146 |
|
|
147 |
class Function(Table): pass |
|
148 |
|
|
149 |
class FunctionCall(Code): |
|
150 |
def __init__(self, function, *args): |
|
151 |
''' |
|
152 |
@param args [Code...] The function's arguments |
|
153 |
''' |
|
154 |
if not isinstance(function, Code): function = Function(function) |
|
155 |
|
|
156 |
self.function = function |
|
157 |
self.args = args |
|
158 |
|
|
159 |
def to_str(self, db): |
|
160 |
args_str = ', '.join((v.to_str(db) for v in self.args)) |
|
161 |
return self.function.to_str(db)+'('+args_str+')' |
|
162 |
|
|
163 |
def __repr__(self): return self.to_str(mockDb, '<args>') |
|
164 |
|
|
145 | 165 |
##### Conditions |
146 | 166 |
|
147 | 167 |
class ColValueCond(Code): |
Also available in: Unified diff
sql_gen.py: Added Functions section with Function and FunctionCall