From: Billy G. Allie <Bill.Allie@mug.org>
To: pygresql@vex.net
Cc: pgsql-interfaces@postgresql.org
Subject: PyGreSQL-3.0 bug + patch
Date: Sun, 04 Jun 2000 01:40:47 -0400
Message-ID: <200006040540.BAA13726@bajor.mug.org> (raw)
The fetch() function in pgmodule.c contains an error where it does not return
the next row each time it is called. It always returns the first row of the
result set. The following patch corrects the problem. It also replaces the
call to bzero() with a call to memset(). Both memset (twice) and bzero (once)
were used in pgmodule.c. I changed bzero to memset to be consistant in usage.
Finally, a string with an embedded newline is fixed.
____ | Billy G. Allie | Domain....: Bill.Allie@mug.org
| /| | 7436 Hartwell | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
|/ |LLIE | (313) 582-1540 |
Attachments:patch.20000604-1 (text/plain, 1.3K) download
*** pgmodule.c.orig Sun Jun 4 01:21:12 2000
--- pgmodule.c Sun Jun 4 01:14:03 2000
***************
*** 550,556 ****
str = Py_None;
}
else
! str = PyString_FromString(PQgetvalue(self->last_result, i, j));
PyTuple_SET_ITEM(rowtuple, j, str);
}
--- 550,557 ----
str = Py_None;
}
else
! str = PyString_FromString(PQgetvalue(self->last_result,
! self->current_row, j));
PyTuple_SET_ITEM(rowtuple, j, str);
}
***************
*** 1502,1508 ****
if (pgport != -1)
{
! bzero(port_buffer, sizeof(port_buffer));
sprintf(port_buffer, "%d", pgport);
npgobj->cnx = PQsetdbLogin(pghost, port_buffer, pgopt, pgtty, pgdbname,
pguser, pgpasswd);
--- 1503,1509 ----
if (pgport != -1)
{
! memset(port_buffer, 0, sizeof(port_buffer));
sprintf(port_buffer, "%d", pgport);
npgobj->cnx = PQsetdbLogin(pghost, port_buffer, pgopt, pgtty, pgdbname,
pguser, pgpasswd);
***************
*** 2976,2983 ****
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
! "set_defpasswd(password), with password (string/
! None).");
return NULL;
}
--- 2977,2983 ----
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
! "set_defpasswd(password), with password (string/None).");
return NULL;
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: Bill.Allie@mug.org, pygresql@vex.net
Subject: Re: PyGreSQL-3.0 bug + patch
In-Reply-To: <200006040540.BAA13726@bajor.mug.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox