Skip to content
Snippets Groups Projects
Commit e4c30e6d authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

pgsql: Wireformat NUMERIC type fixes and finetuning.

parent b7a9e5d3
No related branches found
No related tags found
No related merge requests found
...@@ -912,12 +912,11 @@ class sql_result { ...@@ -912,12 +912,11 @@ class sql_result {
if (sizeof(value) == 1) if (sizeof(value) == 1)
value = (int)value[0]; value = (int)value[0];
else { else {
int i = sizeof(value[1]); int i, denom;
int denom = 1; for (i = sizeof(value[1]), denom = 1; --i >= 0; denom *= 10);
do i = (int)value[0];
denom *= 10; value = (int)value[1];
while (--i >= 0); value = Gmp.mpq(i * denom + (i >= 0 ? value : -value),
value = Gmp.mpq((int)value[0] * denom + (int)value[1],
denom); denom);
} }
} }
...@@ -955,6 +954,8 @@ class sql_result { ...@@ -955,6 +954,8 @@ class sql_result {
case 0:; case 0:;
value = 0; value = 0;
} }
if (alltext)
value = (string)value;
} }
break; break;
case INT8OID:case INT2OID: case INT8OID:case INT2OID:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment