Revision 2376
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
437 | 437 |
table0 = sql_gen.as_Table(tables.pop(0)) # first table is separate |
438 | 438 |
|
439 | 439 |
# Parse other params |
440 |
if conds == None: conds = {} |
|
440 |
if conds == None: conds = [] |
|
441 |
elif isinstance(conds, dict): conds = conds.items() |
|
442 |
conds = conds[:] # don't modify input! |
|
441 | 443 |
assert limit == None or type(limit) == int |
442 | 444 |
assert start == None or type(start) == int |
443 | 445 |
if order_by is order_by_pkey: |
... | ... | |
469 | 471 |
|
470 | 472 |
# Parse special values |
471 | 473 |
if join_.type_ is sql_gen.filter_out: # filter no match |
472 |
conds[sql_gen.Col(table_not_null_col(db, table), table)] = None |
|
474 |
conds.append((sql_gen.Col(table_not_null_col(db, table), table), |
|
475 |
None)) |
|
473 | 476 |
|
474 | 477 |
query += ' '+join_.to_str(db, left_table) |
475 | 478 |
|
476 | 479 |
left_table = table |
477 | 480 |
|
478 | 481 |
missing = True |
479 |
if conds != {}:
|
|
482 |
if conds != []:
|
|
480 | 483 |
query += ' WHERE '+(' AND '.join((sql_gen.as_ValueCond(r).to_str(db, l) |
481 |
for l, r in conds.iteritems())))
|
|
484 |
for l, r in conds))) |
|
482 | 485 |
missing = False |
483 | 486 |
if order_by != None: |
484 | 487 |
query += ' ORDER BY '+sql_gen.as_Col(order_by, table0).to_str(db) |
Also available in: Unified diff
sql.py: mk_select(): conds is list of (key, value) tuples instead of dict (dict still supported for compatibility), so that there can be multiple conditions on the same column