Revision 2292
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
501 | 501 |
return run_query(db, query, params, recover, cacheable) |
502 | 502 |
|
503 | 503 |
def mk_insert_select(db, table, cols=None, select_query=None, params=None, |
504 |
returning=None, embeddable=False, table_is_esc=False):
|
|
504 |
returning=None, embeddable=False): |
|
505 | 505 |
''' |
506 | 506 |
@param returning str|None An inserted column (such as pkey) to return |
507 | 507 |
@param embeddable Whether the query should be embeddable as a nested SELECT. |
508 | 508 |
Warning: If you set this and cacheable=True when the query is run, the |
509 | 509 |
query will be fully cached, not just if it raises an exception. |
510 |
@param table_is_esc Whether the table name has already been escaped |
|
511 | 510 |
''' |
512 | 511 |
if select_query == None: select_query = 'DEFAULT VALUES' |
513 | 512 |
if cols == []: cols = None # no cols (all defaults) = unknown col names |
514 |
table = sql_gen.table2sql_gen(table, table_is_esc).to_str(db)
|
|
513 |
table = sql_gen.as_Table(table).to_str(db)
|
|
515 | 514 |
|
516 | 515 |
# Build query |
517 | 516 |
query = 'INSERT INTO '+table |
Also available in: Unified diff
sql.py: mk_insert_select(): Removed no longer used table_is_esc