Project

General

Profile

« Previous | Next » 

Revision 2310

sql_gen.py: NamedCode: Inherit from Col so that its name can be retrieved using the same attribute as Col's

View differences:

sql_gen.py
58 58
    if col == None or isinstance(col, Code): return col
59 59
    else: return Col(col, table)
60 60

  
61
class NamedCode(Code):
61
class NamedCode(Col):
62 62
    def __init__(self, name, code):
63
        Col.__init__(self, name)
64
        
63 65
        if not isinstance(code, Code): code = Literal(code)
64 66
        
65
        self.name = name
66 67
        self.code = code
67 68
    
68 69
    def to_str(self, db):
69
        return self.code.to_str(db)+' AS '+sql.esc_name(db, self.name)
70
        return self.code.to_str(db)+' AS '+Col.to_str(self, db)
70 71

  
71 72
##### Parameterized SQL code objects
72 73

  

Also available in: Unified diff