Revision 3104
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
252 | 252 |
|
253 | 253 |
def index_col(col): |
254 | 254 |
if not is_table_col(col): return None |
255 |
return col.table.index_cols.get(col.name, None) |
|
255 |
|
|
256 |
table = col.table |
|
257 |
try: name = table.index_cols[col.name] |
|
258 |
except KeyError: return None |
|
259 |
else: return Col(name, table, col.srcs) |
|
256 | 260 |
|
257 | 261 |
def is_temp_col(col): return is_table_col(col) and col.table.is_temp |
258 | 262 |
|
lib/sql.py | ||
---|---|---|
1106 | 1106 |
if not nullable: add_not_null(db, new_col) |
1107 | 1107 |
add_index(db, new_col) |
1108 | 1108 |
|
1109 |
col.table.index_cols[col.name] = new_col |
|
1109 |
col.table.index_cols[col.name] = new_col.name
|
|
1110 | 1110 |
|
1111 | 1111 |
# Controls when ensure_not_null() will use index columns |
1112 | 1112 |
not_null_index_cols_min_rows = 0 # rows; initially always use index columns |
Also available in: Unified diff
sql_gen.py: index_cols: Store just the name of the index column, and add the table in index_col(), in case the table is ever copied and renamed