mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
rename param name to fetch
This commit is contained in:
parent
e2b99d3a8e
commit
b40ac15efc
|
@ -1198,7 +1198,7 @@ def execute_batch(cur, sql, argslist, page_size=100):
|
|||
cur.execute(b";".join(sqls))
|
||||
|
||||
|
||||
def execute_values(cur, sql, argslist, template=None, page_size=100, fetch_result=False):
|
||||
def execute_values(cur, sql, argslist, template=None, page_size=100, fetch=False):
|
||||
'''Execute a statement using :sql:`VALUES` with a sequence of parameters.
|
||||
|
||||
:param cur: the cursor to use to execute the query.
|
||||
|
@ -1229,7 +1229,7 @@ def execute_values(cur, sql, argslist, template=None, page_size=100, fetch_resul
|
|||
statement. If there are more items the function will execute more than
|
||||
one statement.
|
||||
|
||||
:param fetch_result: flag indicating that results of query execution should
|
||||
:param fetch: flag indicating that results of query execution should
|
||||
be returned. Useful for queries with `RETURNING` clause
|
||||
|
||||
.. __: https://www.postgresql.org/docs/current/static/queries-values.html
|
||||
|
@ -1278,10 +1278,10 @@ def execute_values(cur, sql, argslist, template=None, page_size=100, fetch_resul
|
|||
parts.append(b',')
|
||||
parts[-1:] = post
|
||||
cur.execute(b''.join(parts))
|
||||
if fetch_result:
|
||||
if fetch:
|
||||
result.extend(cur.fetchall())
|
||||
|
||||
if fetch_result:
|
||||
if fetch:
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ class TestExecuteValues(FastExecuteTestMixin, testutils.ConnectingTestCase):
|
|||
result = psycopg2.extras.execute_values(cur,
|
||||
"insert into testfast (id, val) values %s returning id",
|
||||
((i, i * 10) for i in range(25)),
|
||||
page_size=10, fetch_many=True)
|
||||
page_size=10, fetch=True)
|
||||
# result contains all returned pages
|
||||
self.assertEqual([r[0] for r in result], list(range(25)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user