Re: libpq PQexecParams and arrays - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: libpq PQexecParams and arrays
Date
Msg-id 927.1149698344@sss.pgh.pa.us
Whole thread Raw
In response to Re: libpq PQexecParams and arrays  (Keary Suska <hierophant@pcisys.net>)
List pgsql-interfaces
Keary Suska <hierophant@pcisys.net> writes:
> To make sure that I understand, do you mean passing a paramValues as an
> array of uint32, or passing values to a *column* that is an array column? If
> it's the latter (array column), I don't think libpq supports array columns
> in this way.

If you're trying to pass a binary parameter value to an array column,
you have to create the correct struct representing an array datatype,
as expected by array_recv.  This implies making the appropriate array
header and (for integer data) converting each value to big-endian byte
order.  A plain C uint32[] array definitely hasn't got the header, and
on Intel platforms it's the wrong byte order too.  There is not anything
built into libpq that will do the translation for you.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Keary Suska
Date:
Subject: Re: libpq PQexecParams and arrays
Next
From: Tom Lane
Date:
Subject: Re: libpq PQexecParams and arrays