Revision 2293
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
416 | 416 |
distinct_on_all = object() # tells mk_select() to SELECT DISTINCT ON all columns |
417 | 417 |
|
418 | 418 |
def mk_select(db, tables, fields=None, conds=None, distinct_on=[], limit=None, |
419 |
start=None, order_by=order_by_pkey, table_is_esc=False, default_table=None):
|
|
419 |
start=None, order_by=order_by_pkey, default_table=None): |
|
420 | 420 |
''' |
421 | 421 |
@param tables The single table to select from, or a list of tables to join |
422 | 422 |
together, with tables after the first being sql_gen.Join objects |
... | ... | |
426 | 426 |
* compare_right_side: ValueCond|literal value |
427 | 427 |
@param distinct_on The columns to SELECT DISTINCT ON, or distinct_on_all to |
428 | 428 |
use all columns |
429 |
@param table_is_esc Whether the table name has already been escaped |
|
430 | 429 |
@return tuple(query, params) |
431 | 430 |
''' |
432 | 431 |
def esc_name_(name): return esc_name(db, name) |
... | ... | |
438 | 437 |
if conds == None: conds = {} |
439 | 438 |
assert limit == None or type(limit) == int |
440 | 439 |
assert start == None or type(start) == int |
441 |
table0 = sql_gen.table2sql_gen(table0, table_is_esc)
|
|
440 |
table0 = sql_gen.as_Table(table0)
|
|
442 | 441 |
if order_by is order_by_pkey: order_by = pkey(db, table0, recover=True) |
443 | 442 |
|
444 | 443 |
params = [] |
Also available in: Unified diff
sql.py: mk_select(): Removed no longer used table_is_esc