Thread: libpq, binary cursors, & arrays

libpq, binary cursors, & arrays

From
Cody Pisto
Date:
Hi all,

I'm putting together a small package of macros and functions
to help deal with binary cursor results from libpq, but I've run into a 
bit of a stumbling block with regard to array results,

for example:
 ArrayType *arr; uint64_t *lin;
 ...
res = PQexecParams(conn, "select '{1,2,3}'::bigint[]", 1, NULL,                       paramValues, NULL, NULL, 1); ...
 arr = (ArrayType *)PQgetvalue(res, 0, 1); lin = (uint64_t *)ARR_DATA_PTR(lin); printf("%lld\n", lin[0]);
 does not produce the expected results


Any pointers would be much appreciated,

Thanks in advance,

---
Cody Pisto <cody@hpcs.com>