From: Bruce Momjian Date: Thu, 16 Aug 2001 15:21:53 +0000 (+0000) Subject: This patch fixes the well-known but unfixed bug that fetchone() always X-Git-Tag: REL7_1_3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b97a098e164e1d1dae04c953618e8cb66431f9b;p=thirdparty%2Fpostgresql.git This patch fixes the well-known but unfixed bug that fetchone() always returns the first result in the DB-API compliant wrapper. It turned out that the bug was way down in the C code. Gerhard Häring --- diff --git a/src/interfaces/python/pgmodule.c b/src/interfaces/python/pgmodule.c index a1ce3cd33fe..d1a4907189f 100644 --- a/src/interfaces/python/pgmodule.c +++ b/src/interfaces/python/pgmodule.c @@ -554,13 +554,13 @@ pgsource_fetch(pgsourceobject * self, PyObject * args) for (j = 0; j < self->num_fields; j++) { - if (PQgetisnull(self->last_result, i, j)) + if (PQgetisnull(self->last_result, self->current_row, j)) { Py_INCREF(Py_None); str = Py_None; } else - str = PyString_FromString(PQgetvalue(self->last_result, i, j)); + str = PyString_FromString(PQgetvalue(self->last_result, self->current_row, j)); PyTuple_SET_ITEM(rowtuple, j, str); }