Commit f7eedfdf authored by Bruce Momjian's avatar Bruce Momjian

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
parent 1e59edd2
...@@ -548,13 +548,13 @@ pgsource_fetch(pgsourceobject * self, PyObject * args) ...@@ -548,13 +548,13 @@ pgsource_fetch(pgsourceobject * self, PyObject * args)
for (j = 0; j < self->num_fields; j++) 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); Py_INCREF(Py_None);
str = Py_None; str = Py_None;
} }
else 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); PyTuple_SET_ITEM(rowtuple, j, str);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment