diff --git a/CHANGES b/CHANGES index 855d0df9c14b3af094f541d77300147cbb09f73b..3d06c7f492d226b2edb87a9eeef17c500bcea329 100644 --- a/CHANGES +++ b/CHANGES @@ -731,7 +731,7 @@ o Sql Current features: no library dependencies (no libpq), native binding support, streaming support, NOTIFY/LISTEN support (fully eventdriven, 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 queries on the same connection (i.e. multiple PostgreSQL-portal- support), automatic precompilation and caching of often-used diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike index 69d65b4a2f21505887bcb4244c2a534e7e016c52..43b2008f1bbf4cd0dfb68ae7b8deba4d89c04498 100644 --- a/lib/modules/Sql.pmod/pgsql.pike +++ b/lib/modules/Sql.pmod/pgsql.pike @@ -128,6 +128,7 @@ protected string _sprintf(int type, void|mapping flags) { #define OIDOID 26 #define XMLOID 142 #define FLOAT4OID 700 +#define FLOAT8OID 701 #define MACADDROID 829 #define INETOID 869 /* Force textmode */ #define BPCHAROID 1042 @@ -752,6 +753,9 @@ final int _decodemsg(void|state waitforstate) { break; case INT8OID:value=_c.getint64(); break; +#if SIZEOF_FLOAT>=8 + case FLOAT8OID: +#endif case FLOAT4OID: value=_c.getstring(collen); if(!atext) diff --git a/src/modules/_PGsql/PGsql.cmod b/src/modules/_PGsql/PGsql.cmod index c8c80e80cde4aebf9fb153171a6946ef03686224..3f72a02522256ac64b7d8cbe787439ee868455fd 100644 --- a/src/modules/_PGsql/PGsql.cmod +++ b/src/modules/_PGsql/PGsql.cmod @@ -1,5 +1,5 @@ /* -*- 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. * @@ -58,6 +58,7 @@ typedef unsigned char uchar; #define OIDOID 26 #define XMLOID 142 #define FLOAT4OID 700 +#define FLOAT8OID 701 #define MACADDROID 829 #define INETOID 869 #define BPCHAROID 1042 @@ -356,10 +357,15 @@ outofmem: Pike_fatal("Out of memory\n"); svp = low_mapping_string_lookup(drd.u.mapping, MK_STRING("type")); free_svalue(&drd); switch(svp->u.integer) { +#if SIZEOF_FLOAT_TYPE>=8 + case FLOAT8OID: +#endif case FLOAT4OID: if(!alltext) { char*tb=xalloc(collen+1); char*p=tb; + if(!tb) + Pike_fatal("Out of memory\n"); do *p++=low_getbyte(); while(--collen); @@ -389,7 +395,10 @@ outofmem: Pike_fatal("Out of memory\n"); case INT2OID:push_int(low_getint16()); break; 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(); switch(firstword) { default: @@ -416,6 +425,7 @@ nextor: push_int(nextword); else simple: push_int(nextword); } +#endif break; } case OIDOID: