Revision 5525
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql.py | ||
---|---|---|
1177 | 1177 |
except StopIteration: return table_pkey_index(db, table, recover) |
1178 | 1178 |
|
1179 | 1179 |
def table_order_by(db, table, recover=None): |
1180 |
try: return index_order_by(db, table_cluster_on(db, table, recover)) |
|
1181 |
except DoesNotExistException: return None |
|
1180 |
if table.order_by == None: |
|
1181 |
try: table.order_by = index_order_by(db, table_cluster_on(db, table, |
|
1182 |
recover)) |
|
1183 |
except DoesNotExistException: pass |
|
1184 |
return table.order_by |
|
1182 | 1185 |
|
1183 | 1186 |
#### Functions |
1184 | 1187 |
|
... | ... | |
1358 | 1361 |
if like != None: |
1359 | 1362 |
cols = [sql_gen.CustomCode('LIKE '+like.to_str(db)+' INCLUDING ALL') |
1360 | 1363 |
]+cols |
1364 |
table.order_by = like.order_by |
|
1361 | 1365 |
if has_pkey: |
1362 | 1366 |
cols[0] = pkey = copy.copy(cols[0]) # don't modify input! |
1363 | 1367 |
pkey.constraints = 'PRIMARY KEY' |
Also available in: Unified diff
sql.py: table_order_by(): Cache the order_by in table.order_by and propagate it when a LIKE table is created