Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f7eedfd

Browse files
committed
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
1 parent 1e59edd commit f7eedfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interfaces/python/pgmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,13 @@ pgsource_fetch(pgsourceobject * self, PyObject * args)
548548

549549
for (j = 0; j < self->num_fields; j++)
550550
{
551-
if (PQgetisnull(self->last_result, i, j))
551+
if (PQgetisnull(self->last_result, self->current_row, j))
552552
{
553553
Py_INCREF(Py_None);
554554
str = Py_None;
555555
}
556556
else
557-
str = PyString_FromString(PQgetvalue(self->last_result, i, j));
557+
str = PyString_FromString(PQgetvalue(self->last_result, self->current_row, j));
558558

559559
PyTuple_SET_ITEM(rowtuple, j, str);
560560
}

0 commit comments

Comments
 (0)