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

pgsql: Polished native support for 64-bit ints and doubles.

Rev: CHANGES:1.131
Rev: lib/modules/Sql.pmod/pgsql.pike:1.36
Rev: src/modules/_PGsql/PGsql.cmod:1.29
parent f6f97264
Branches
Tags
No related merge requests found
...@@ -731,7 +731,7 @@ o Sql ...@@ -731,7 +731,7 @@ o Sql
Current features: no library dependencies (no libpq), native binding Current features: no library dependencies (no libpq), native binding
support, streaming support, NOTIFY/LISTEN support (fully eventdriven, support, streaming support, NOTIFY/LISTEN support (fully eventdriven,
no polling), binary support for integer, float and string datatypes no polling), binary support for integer, float and string datatypes
through big_typed_query(), through big_typed_query(), native support for 64-bit ints and doubles,
COPY FROM/TO STDIN/STDOUT support, multiple simultaneous streaming COPY FROM/TO STDIN/STDOUT support, multiple simultaneous streaming
queries on the same connection (i.e. multiple PostgreSQL-portal- queries on the same connection (i.e. multiple PostgreSQL-portal-
support), automatic precompilation and caching of often-used support), automatic precompilation and caching of often-used
......
...@@ -128,6 +128,7 @@ protected string _sprintf(int type, void|mapping flags) { ...@@ -128,6 +128,7 @@ protected string _sprintf(int type, void|mapping flags) {
#define OIDOID 26 #define OIDOID 26
#define XMLOID 142 #define XMLOID 142
#define FLOAT4OID 700 #define FLOAT4OID 700
#define FLOAT8OID 701
#define MACADDROID 829 #define MACADDROID 829
#define INETOID 869 /* Force textmode */ #define INETOID 869 /* Force textmode */
#define BPCHAROID 1042 #define BPCHAROID 1042
...@@ -752,6 +753,9 @@ final int _decodemsg(void|state waitforstate) { ...@@ -752,6 +753,9 @@ final int _decodemsg(void|state waitforstate) {
break; break;
case INT8OID:value=_c.getint64(); case INT8OID:value=_c.getint64();
break; break;
#if SIZEOF_FLOAT>=8
case FLOAT8OID:
#endif
case FLOAT4OID: case FLOAT4OID:
value=_c.getstring(collen); value=_c.getstring(collen);
if(!atext) if(!atext)
......
/* -*- c -*- /* -*- c -*-
* $Id: PGsql.cmod,v 1.28 2008/08/25 23:39:00 srb Exp $ * $Id: PGsql.cmod,v 1.29 2008/08/25 23:39:16 srb Exp $
* *
* PGsql, accelerator functions for Sql.pgsql for Pike. * PGsql, accelerator functions for Sql.pgsql for Pike.
* *
...@@ -58,6 +58,7 @@ typedef unsigned char uchar; ...@@ -58,6 +58,7 @@ typedef unsigned char uchar;
#define OIDOID 26 #define OIDOID 26
#define XMLOID 142 #define XMLOID 142
#define FLOAT4OID 700 #define FLOAT4OID 700
#define FLOAT8OID 701
#define MACADDROID 829 #define MACADDROID 829
#define INETOID 869 #define INETOID 869
#define BPCHAROID 1042 #define BPCHAROID 1042
...@@ -356,10 +357,15 @@ outofmem: Pike_fatal("Out of memory\n"); ...@@ -356,10 +357,15 @@ outofmem: Pike_fatal("Out of memory\n");
svp = low_mapping_string_lookup(drd.u.mapping, MK_STRING("type")); svp = low_mapping_string_lookup(drd.u.mapping, MK_STRING("type"));
free_svalue(&drd); free_svalue(&drd);
switch(svp->u.integer) { switch(svp->u.integer) {
#if SIZEOF_FLOAT_TYPE>=8
case FLOAT8OID:
#endif
case FLOAT4OID: case FLOAT4OID:
if(!alltext) { if(!alltext) {
char*tb=xalloc(collen+1); char*tb=xalloc(collen+1);
char*p=tb; char*p=tb;
if(!tb)
Pike_fatal("Out of memory\n");
do do
*p++=low_getbyte(); *p++=low_getbyte();
while(--collen); while(--collen);
...@@ -389,7 +395,10 @@ outofmem: Pike_fatal("Out of memory\n"); ...@@ -389,7 +395,10 @@ outofmem: Pike_fatal("Out of memory\n");
case INT2OID:push_int(low_getint16()); case INT2OID:push_int(low_getint16());
break; break;
case INT8OID: { case INT8OID: {
int firstword = low_getint32(); INT_TYPE firstword = low_getint32();
#if SIZEOF_INT_TYPE>=8
push_int(firstword<<32|low_getint32()&0xffffffffU);
#else
int nextword = low_getint32(); int nextword = low_getint32();
switch(firstword) { switch(firstword) {
default: default:
...@@ -416,6 +425,7 @@ nextor: push_int(nextword); ...@@ -416,6 +425,7 @@ nextor: push_int(nextword);
else else
simple: push_int(nextword); simple: push_int(nextword);
} }
#endif
break; break;
} }
case OIDOID: case OIDOID:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment