Revision 2291
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
438 | 438 |
if conds == None: conds = {} |
439 | 439 |
assert limit == None or type(limit) == int |
440 | 440 |
assert start == None or type(start) == int |
441 |
if order_by is order_by_pkey: |
|
442 |
order_by = pkey(db, table0, recover=True, table_is_esc=table_is_esc) |
|
443 | 441 |
table0 = sql_gen.table2sql_gen(table0, table_is_esc) |
442 |
if order_by is order_by_pkey: order_by = pkey(db, table0, recover=True) |
|
444 | 443 |
|
445 | 444 |
params = [] |
446 | 445 |
|
... | ... | |
600 | 599 |
|
601 | 600 |
##### Database structure queries |
602 | 601 |
|
603 |
def pkey(db, table, recover=None, table_is_esc=False):
|
|
602 |
def pkey(db, table, recover=None): |
|
604 | 603 |
'''Assumed to be first column in table''' |
605 |
return col_names(select(db, table, limit=0, order_by=None, recover=recover,
|
|
606 |
table_is_esc=table_is_esc)).next()
|
|
604 |
return col_names(select(db, table, limit=0, order_by=None, |
|
605 |
recover=recover)).next()
|
|
607 | 606 |
|
608 | 607 |
def index_cols(db, table, index): |
609 | 608 |
'''Can also use this for UNIQUE constraints, because a UNIQUE index is |
Also available in: Unified diff
sql.py: pkey(): Removed no longer used table_is_esc