Project

General

Profile

« Previous | Next » 

Revision 2742

sql_gen.py: NamedTable: cols: Use sql_gen.Col objects or name strings instead of pre-rendered SQL code

View differences:

sql_gen.py
148 148
        
149 149
        if not isinstance(code, Code): code = Table(code)
150 150
        if not isinstance(code, (Table, FunctionCall, Expr)): code = Expr(code)
151
        if cols != None: cols = map(to_name_only_col, cols)
151 152
        
152 153
        self.code = code
153 154
        self.cols = cols
154 155
    
155 156
    def to_str(self, db):
156 157
        str_ = self.code.to_str(db)+'\nAS '+Table.to_str(self, db)
157
        if self.cols != None: str_ += ' ('+(', '.join(self.cols))+')'
158
        if self.cols != None:
159
            str_ += ' ('+(', '.join((c.to_str(db) for c in self.cols)))+')'
158 160
        return str_
159 161
    
160 162
    def to_Table(self): return Table(self.name)

Also available in: Unified diff