Project

General

Profile

« Previous | Next » 

Revision 3000

sql_gen.py: Store index cols in the table instead of in the column, because columns are often recreated from the table and name but tables are generally not copied

View differences:

sql_gen.py
144 144
        self.name = name
145 145
        self.schema = schema
146 146
        self.is_temp = is_temp
147
        self.index_cols = {}
147 148
    
148 149
    def to_str(self, db):
149 150
        str_ = ''
......
152 153
        return str_
153 154
    
154 155
    def to_Table(self): return self
156
    
157
    def _compare_on(self):
158
        compare_on = Derived._compare_on(self)
159
        del compare_on['index_cols'] # ignore
160
        return compare_on
155 161

  
156 162
def is_underlying_table(table):
157 163
    return isinstance(table, Table) and table.to_Table() is table
......
208 214
        
209 215
        self.name = name
210 216
        self.table = table
211
        self.index_col = None
212 217
    
213 218
    def to_str(self, db, for_str=False):
214 219
        str_ = db.esc_name(self.name)
......
225 230

  
226 231
def is_table_col(col): return isinstance(col, Col) and col.table != None
227 232

  
228
def is_indexed_col(col): return isinstance(col, Col) and col.index_col != None
233
def index_col(col):
234
    if not is_table_col(col): return None
235
    return col.table.index_cols.get(col.name, None)
229 236

  
230 237
def is_temp_col(col): return col.table != None and col.table.is_temp
231 238

  

Also available in: Unified diff