Revision 2757
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
469 | 469 |
# all cols w/ USING, so can use simpler USING syntax |
470 | 470 |
cols = map(to_name_only_col, joins.iterkeys()) |
471 | 471 |
join_cond = 'USING ('+(', '.join((c.to_str(db) for c in cols)))+')' |
472 |
else: |
|
473 |
if len(joins) == 1: whitespace = ' ' |
|
474 |
else: whitespace = '\n' |
|
475 |
join_cond = combine_conds(map(join, joins.iteritems()), 'ON') |
|
472 |
else: join_cond = combine_conds(map(join, joins.iteritems()), 'ON') |
|
476 | 473 |
|
474 |
if isinstance(self.table, NamedTable): whitespace = '\n' |
|
475 |
else: whitespace = ' ' |
|
476 |
|
|
477 | 477 |
# Create join |
478 | 478 |
if type_ is filter_out: type_ = 'LEFT' |
479 | 479 |
str_ = '' |
480 | 480 |
if type_ != None: str_ += type_+' ' |
481 |
str_ += 'JOIN '+self.table.to_str(db)
|
|
482 |
if join_cond != None: str_ += ' '+join_cond
|
|
481 |
str_ += 'JOIN'+whitespace+self.table.to_str(db)
|
|
482 |
if join_cond != None: str_ += whitespace+join_cond
|
|
483 | 483 |
return str_ |
484 | 484 |
|
485 | 485 |
def __repr__(self): return self.to_str(mockDb, '<left_table>') |
Also available in: Unified diff
sql_gen.py: Join.to_str(): Add newline before and after right table if it's been renamed (and therefore takes up multiple lines)