Revision 2280
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
419 | 419 |
start=None, order_by=order_by_pkey, table_is_esc=False, default_table=None): |
420 | 420 |
''' |
421 | 421 |
@param tables The single table to select from, or a list of tables to join |
422 |
together: [table0, (table1, joins), ...] |
|
423 |
|
|
424 |
joins has the format: dict(right_col=left_col, ...) |
|
425 |
* if left_col is sql_gen.join_using, left_col is set to right_col |
|
422 |
together, with tables after the first being sql_gen.Join objects |
|
426 | 423 |
@param fields Use None to select all fields in the table |
427 | 424 |
@param conds WHERE conditions: dict(compare_left_side=compare_right_side): |
428 | 425 |
* compare_left_side: Code|str (for col name) |
... | ... | |
473 | 470 |
query += ' FROM '+table0.to_str(db) |
474 | 471 |
|
475 | 472 |
# Add joins |
476 |
tables = [sql_gen.join2sql_gen(v, table_is_esc) for v in tables] |
|
477 | 473 |
left_table = table0 |
478 | 474 |
for join_ in tables: |
479 | 475 |
# Parse special values |
... | ... | |
812 | 808 |
|
813 | 809 |
db.log_debug('Joining together output and input pkeys') |
814 | 810 |
run_query_into_pkeys(*mk_select(db, [in_pkeys_ref[0], |
815 |
(out_pkeys_ref[0], {row_num_col: sql_gen.join_using})], pkeys,
|
|
816 |
start=0)) |
|
811 |
sql_gen.Join(out_pkeys_ref[0],
|
|
812 |
{row_num_col: sql_gen.join_using})], pkeys, start=0))
|
|
817 | 813 |
|
818 | 814 |
break # insert successful |
819 | 815 |
except DuplicateKeyException, e: |
Also available in: Unified diff
sql.py: put_table(): Switched joins to sql_gen.Join objects. mk_select(): Only accept joins which are sql_gen.Join objects.