Revision 3420
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
655 | 655 |
|
656 | 656 |
distinct_on_all = object() # tells mk_select() to SELECT DISTINCT ON all columns |
657 | 657 |
|
658 |
def mk_select(db, tables, fields=None, conds=None, distinct_on=[], limit=None,
|
|
659 |
start=None, order_by=order_by_pkey, default_table=None): |
|
658 |
def mk_select(db, tables=None, fields=None, conds=None, distinct_on=[],
|
|
659 |
limit=None, start=None, order_by=order_by_pkey, default_table=None):
|
|
660 | 660 |
''' |
661 | 661 |
@param tables The single table to select from, or a list of tables to join |
662 | 662 |
together, with tables after the first being sql_gen.Join objects |
... | ... | |
706 | 706 |
# Main table |
707 | 707 |
if query.find('\n') >= 0 or len(tables) > 0: whitespace = '\n' |
708 | 708 |
else: whitespace = ' ' |
709 |
query += whitespace+'FROM '+table0.to_str(db) |
|
709 |
if table0 != None: query += whitespace+'FROM '+table0.to_str(db)
|
|
710 | 710 |
|
711 | 711 |
# Add joins |
712 | 712 |
left_table = table0 |
Also available in: Unified diff
sql.py: mk_select(): Support queries without a FROM clause