Project

General

Profile

« Previous | Next » 

Revision 3354

sql_gen.py: Added cast_literal()

View differences:

lib/sql_gen.py
436 436
    def to_str(self, db):
437 437
        return 'CAST('+self.value.to_str(db)+' AS '+self.type_+')'
438 438

  
439
def cast_literal(value):
440
    if not isinstance(value, Literal): return value
441
    
442
    if util.is_str(value.value): value = Cast('text', value)
443
    return value
444

  
439 445
##### Conditions
440 446

  
441 447
class NotCond(Code):

Also available in: Unified diff