Revision 3539
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
721 | 721 |
|
722 | 722 |
class Cast(FunctionCall): |
723 | 723 |
def __init__(self, type_, value): |
724 |
type_ = as_Code(type_) |
|
724 | 725 |
value = as_Value(value) |
725 | 726 |
|
726 | 727 |
self.type_ = type_ |
727 | 728 |
self.value = value |
728 | 729 |
|
729 | 730 |
def to_str(self, db): |
730 |
return 'CAST('+self.value.to_str(db)+' AS '+self.type_+')' |
|
731 |
return 'CAST('+self.value.to_str(db)+' AS '+self.type_.to_str(db)+')'
|
|
731 | 732 |
|
732 | 733 |
def cast_literal(value): |
733 | 734 |
if not is_literal(value): return value |
Also available in: Unified diff
sql_gen.py: Cast: Support types which are Code objects