.executemany() fixes.

This commit is contained in:
Federico Di Gregorio 2005-03-12 09:19:59 +00:00
parent 19c5129d5b
commit 30b2ba6ebf
2 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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;
}