Обсуждение: [NOVICE] unpacking result (in binary form)
Hi All!
Can someone point me to a structure which has been described a form of array?
I can get a pointer to some area with PQgetvalue but I'm need to retrieve every element from the array.
TIA.
--
С уважением,
Ruslan R. Laishev
Ruslan R. Laishev
OpenVMS bigot, natural born system/network progger, C contractor.
+79013163222
+79910009922
Hi !
Resolved.
#pragma pack(push, 1)
/* Decsriptor of the PG Array single element = longword prefixed data block */
typedef struct __pg_data_dsc__ {
unsigned length;
unsigned char data[0];
} PG_DATA_DSC;
/* Descriptor of the PG Array in the binary form, as it is returned by PGgetvalue*/
typedef struct __pg_array_dsc__ {
unsigned ndim; /* N Dimensions */
unsigned undef;
Oid type; /* OID of the elements */
unsigned asize; /* Array size - number of elements */
unsigned undef2;
/* A place holder of the first element */
PG_DATA_DSC elm[0];
} PG_ARRAY_DSC;
#pragma pack(pop)
...
p_arr = PQgetvalue(res, ...);
p_arr->asize = ntohl(p_arr->asize);
p_arr->ndim = ntohl(p_arr->ndim);
p_arr->type = ntohl(p_arr->type);
p_elem = p_arr->elm;
30.10.2017, 13:20, "Ruslan R. Laishev" <zator@yandex.ru>:
Hi All!Can someone point me to a structure which has been described a form of array?I can get a pointer to some area with PQgetvalue but I'm need to retrieve every element from the array.TIA.--С уважением,
Ruslan R. LaishevOpenVMS bigot, natural born system/network progger, C contractor.+79013163222+79910009922
--
С уважением,
Ruslan R. Laishev
Ruslan R. Laishev
OpenVMS bigot, natural born system/network progger, C contractor.
+79013163222
+79910009922