1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-15 14:02:29 +03:00
saw a fix offered up.  Since I'm gearing up to use Postgres and Python
soon, I figured I'd have a hand at trying to get this sucker addressed.
Apologies if this has already been plugged.  I looked in the archives
and never saw a response.

At any rate, I must admit I don't think I fully understand the
implications of some of the changes I made even though they appear to be
straight forward.  We all know the devil is in the details.  Anyone more
knowledgeable is requested to review my changes. :(

I also updated the advanced.py script in a somewhat nonsensical fashion
to make use of an int8 field in an effort to test this change.  It seems
to run okay, however, this is by no means an all exhaustive test.  So,
it's possible that a bumpy road may lay ahead for some.  On the other
hand...overflows (hopefully) previously lurked (long -> int conversion).

Greg Copeland
This commit is contained in:
Bruce Momjian
2002-08-15 03:31:45 +00:00
parent db147006c1
commit 147aa84c1a
2 changed files with 52 additions and 15 deletions

View File

@@ -289,24 +289,27 @@ get_type_array(PGresult *result, int nfields)
{
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
typ[j] = 1;
break;
case INT8OID:
typ[j] = 2;
break;
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
typ[j] = 2;
break;
case CASHOID:
typ[j] = 3;
break;
default:
case CASHOID:
typ[j] = 4;
break;
default:
typ[j] = 5;
break;
}
}
@@ -1797,24 +1800,27 @@ pgquery_getresult(pgqueryobject * self, PyObject * args)
{
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
typ[j] = 1;
break;
case INT8OID:
typ[j] = 2;
break;
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
typ[j] = 2;
break;
case CASHOID:
typ[j] = 3;
break;
default:
case CASHOID:
typ[j] = 4;
break;
default:
typ[j] = 5;
break;
}
}
@@ -1846,10 +1852,14 @@ pgquery_getresult(pgqueryobject * self, PyObject * args)
break;
case 2:
val = PyFloat_FromDouble(strtod(s, NULL));
val = PyLong_FromLong(strtol(s, NULL, 10));
break;
case 3:
val = PyFloat_FromDouble(strtod(s, NULL));
break;
case 4:
{
int mult = 1;
@@ -1946,11 +1956,14 @@ pgquery_dictresult(pgqueryobject * self, PyObject * args)
{
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
typ[j] = 1;
break;
case INT8OID:
typ[j] = 2;
break;
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
@@ -1995,10 +2008,14 @@ pgquery_dictresult(pgqueryobject * self, PyObject * args)
break;
case 2:
val = PyFloat_FromDouble(strtod(s, NULL));
val = PyLong_FromLong(strtol(s, NULL, 10));
break;
case 3:
val = PyFloat_FromDouble(strtod(s, NULL));
break;
case 4:
{
int mult = 1;