Revision 2497
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
546 | 546 |
if returning != None: returning = sql_gen.as_Col(returning, table) |
547 | 547 |
|
548 | 548 |
# Build query |
549 |
query = 'INSERT INTO '+table.to_str(db) |
|
549 |
first_line = 'INSERT INTO '+table.to_str(db) |
|
550 |
query = first_line |
|
550 | 551 |
if cols != None: query += '\n('+', '.join(cols)+')' |
551 | 552 |
query += '\n'+select_query |
552 | 553 |
|
... | ... | |
560 | 561 |
assert returning != None |
561 | 562 |
|
562 | 563 |
# Create function |
563 |
function_name = '_'.join(['insert', table.name] + cols)
|
|
564 |
function_name = clean_name(first_line)
|
|
564 | 565 |
return_type = 'SETOF '+returning.to_str(db)+'%TYPE' |
565 | 566 |
while True: |
566 | 567 |
try: |
Also available in: Unified diff
sql.py: mk_insert_select(): embeddable: function_name is first line of query for clarity, and to reduce length from including the column names. This also fixes the problem of double quotes around column names in the previous function_name.