mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
.executemany() fixes.
This commit is contained in:
parent
19c5129d5b
commit
30b2ba6ebf
|
@ -46,8 +46,7 @@ data = [('Tom', 'Jenkins', '37'),
|
|||
('Madonna', None, '45'),
|
||||
('Federico', 'Di Gregorio', None)]
|
||||
query = "INSERT INTO test_copy VALUES (%s, %s, %s)"
|
||||
for row in data:
|
||||
curs.execute(query, row)
|
||||
curs.executemany(query, data)
|
||||
conn.commit()
|
||||
|
||||
# copy_to using defaults
|
||||
|
|
|
@ -433,7 +433,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
|
||||
static char *kwlist[] = {"query", "vars", NULL};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Oi", kwlist,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O", kwlist,
|
||||
&operation, &vars)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
|
||||
for (i = 0; i < PySequence_Size(vars); i++) {
|
||||
PyObject *v = PySequence_GetItem(vars, i);
|
||||
if (!v || _psyco_curs_execute(self, operation, vars, 0) == 0) {
|
||||
if (!v || _psyco_curs_execute(self, operation, v, 0) == 0) {
|
||||
Py_XDECREF(v);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user