Project

General

Profile

« Previous | Next » 

Revision 2986

sql_gen.py: Added Cast

View differences:

lib/sql_gen.py
359 359
        assert name == None or name == check_name
360 360
    return func_call.args[0]
361 361

  
362
##### Casts
363

  
364
class Cast(FunctionCall):
365
    def __init__(self, type_, value):
366
        value = as_Value(value)
367
        
368
        self.type_ = type_
369
        self.value = value
370
    
371
    def to_str(self, db):
372
        return 'CAST('+self.value.to_str(db)+' AS '+self.type_+')'
373

  
362 374
##### Conditions
363 375

  
364 376
class ColValueCond(Code):

Also available in: Unified diff