Revision 2737
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
455 | 455 |
|
456 | 456 |
##### Value exprs |
457 | 457 |
|
458 |
default = CustomCode('DEFAULT') |
|
459 |
|
|
458 | 460 |
row_count = CustomCode('count(*)') |
459 | 461 |
|
460 | 462 |
def EnsureNotNull(value, null=r'\N'): |
461 | 463 |
return FunctionCall(InternalFunction('coalesce'), as_Col(value), null) |
462 | 464 |
|
465 |
##### Table exprs |
|
466 |
|
|
467 |
class Values(Code): |
|
468 |
def __init__(self, values): |
|
469 |
values = map(remove_col_rename, map(as_Value, values)) |
|
470 |
|
|
471 |
self.values = values |
|
472 |
|
|
473 |
def to_str(self, db): |
|
474 |
return 'VALUES ('+(', '.join((v.to_str(db) for v in self.values)))+')' |
|
475 |
|
|
463 | 476 |
##### Database structure |
464 | 477 |
|
465 | 478 |
class TypedCol(Col): |
Also available in: Unified diff
sql_gen.py: Added Values and default