mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Some harmless adjustments in execute_values() code
No optional result, and create the list only if requred.
This commit is contained in:
parent
2e591e27f2
commit
6fdac46137
|
@ -1268,7 +1268,7 @@ def execute_values(cur, sql, argslist, template=None, page_size=100, fetch=False
|
||||||
sql = sql.encode(_ext.encodings[cur.connection.encoding])
|
sql = sql.encode(_ext.encodings[cur.connection.encoding])
|
||||||
pre, post = _split_sql(sql)
|
pre, post = _split_sql(sql)
|
||||||
|
|
||||||
result = []
|
result = [] if fetch else None
|
||||||
for page in _paginate(argslist, page_size=page_size):
|
for page in _paginate(argslist, page_size=page_size):
|
||||||
if template is None:
|
if template is None:
|
||||||
template = b'(' + b','.join([b'%s'] * len(page[0])) + b')'
|
template = b'(' + b','.join([b'%s'] * len(page[0])) + b')'
|
||||||
|
@ -1281,7 +1281,6 @@ def execute_values(cur, sql, argslist, template=None, page_size=100, fetch=False
|
||||||
if fetch:
|
if fetch:
|
||||||
result.extend(cur.fetchall())
|
result.extend(cur.fetchall())
|
||||||
|
|
||||||
if fetch:
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user