mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Fixes to let the dbapi20 test suite pass.
Submitted by James Henstridge in ticket #195.
This commit is contained in:
parent
75cb5d75d7
commit
fd1ee6fffc
|
@ -525,6 +525,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
}
|
||||
Py_XDECREF(iter);
|
||||
self->rowcount = -1;
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
@ -931,7 +932,7 @@ psyco_curs_callproc(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
char *procname = NULL, *sql = NULL;
|
||||
long int async = 0;
|
||||
Py_ssize_t procname_len, i, nparameters = 0, sl = 0;
|
||||
PyObject *parameters = NULL;
|
||||
PyObject *parameters = Py_None;
|
||||
PyObject *operation = NULL;
|
||||
PyObject *res = NULL;
|
||||
|
||||
|
@ -948,7 +949,7 @@ psyco_curs_callproc(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if(parameters && parameters != Py_None) {
|
||||
if(parameters != Py_None) {
|
||||
nparameters = PyObject_Length(parameters);
|
||||
if (nparameters < 0) nparameters = 0;
|
||||
}
|
||||
|
@ -969,8 +970,8 @@ psyco_curs_callproc(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
PyMem_Free((void*)sql);
|
||||
|
||||
if (_psyco_curs_execute(self, operation, parameters, async)) {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
Py_INCREF(parameters);
|
||||
res = parameters;
|
||||
}
|
||||
|
||||
Py_DECREF(operation);
|
||||
|
|
|
@ -844,6 +844,7 @@ int
|
|||
pq_fetch(cursorObject *curs)
|
||||
{
|
||||
int pgstatus, ex = -1;
|
||||
const char *rowcount;
|
||||
|
||||
/* even if we fail, we remove any information about the previous query */
|
||||
curs_reset(curs);
|
||||
|
@ -920,7 +921,11 @@ pq_fetch(cursorObject *curs)
|
|||
|
||||
case PGRES_COMMAND_OK:
|
||||
Dprintf("pq_fetch: command returned OK (no tuples)");
|
||||
curs->rowcount = atoi(PQcmdTuples(curs->pgres));
|
||||
rowcount = PQcmdTuples(curs->pgres);
|
||||
if (!rowcount || !rowcount[0])
|
||||
curs->rowcount = -1;
|
||||
else
|
||||
curs->rowcount = atoi(rowcount);
|
||||
curs->lastoid = PQoidValue(curs->pgres);
|
||||
CLEARPGRES(curs->pgres);
|
||||
ex = 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user