Revision 2224
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
478 | 478 |
left_join_ref[0] = True |
479 | 479 |
conds[(table, right_col)] = None # filter query by no match |
480 | 480 |
|
481 |
# Create SQL |
|
482 |
right_col = table+'.'+esc_name_(right_col) |
|
483 |
sql_ = right_col+' ' |
|
484 |
if isinstance(left_col, tuple) and len(left_col) == 1: |
|
485 |
# col is literal value |
|
486 |
value, = left_col |
|
487 |
if value == None: sql_ += 'IS' |
|
488 |
else: sql_ += '=' |
|
489 |
sql_ += ' %s' |
|
490 |
params.append(value) |
|
491 |
else: # col is name |
|
492 |
left_col = parse_col(left_col, left_table) |
|
493 |
sql_ += ('= '+left_col+' OR ('+right_col+' IS NULL AND ' |
|
494 |
+left_col+' IS NULL)') |
|
495 |
|
|
496 |
return sql_ |
|
481 |
return cond((right_col, left_col)) |
|
497 | 482 |
|
498 | 483 |
# Create join condition and determine join type |
499 | 484 |
if reduce(operator.and_, (v == join_using for v in joins.itervalues())): |
Also available in: Unified diff
sql.py: mk_select(): join(): Use cond() now that it supports sql_gen format