aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/python/pgmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/python/pgmodule.c')
-rw-r--r--src/interfaces/python/pgmodule.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/interfaces/python/pgmodule.c b/src/interfaces/python/pgmodule.c
index df685902531..355c3e4725d 100644
--- a/src/interfaces/python/pgmodule.c
+++ b/src/interfaces/python/pgmodule.c
@@ -289,23 +289,26 @@ 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;
+ typ[j] = 3;
break;
case CASHOID:
- typ[j] = 3;
+ typ[j] = 4;
break;
default:
- typ[j] = 4;
+ typ[j] = 5;
break;
}
}
@@ -1797,23 +1800,26 @@ 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;
+ typ[j] = 3;
break;
case CASHOID:
- typ[j] = 3;
+ typ[j] = 4;
break;
default:
- typ[j] = 4;
+ 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;