Re: libpq PQexecParams and arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Keary Suska <hierophant(at)pcisys(dot)net>
Cc: Alexey Slynko <slynko(at)tronet(dot)ru>, Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq PQexecParams and arrays
Date: 2006-06-07 16:39:04
Message-ID: 927.1149698344@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Keary Suska <hierophant(at)pcisys(dot)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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2006-06-07 17:20:02 Re: libpq PQexecParams and arrays
Previous Message Keary Suska 2006-06-07 16:05:32 Re: libpq PQexecParams and arrays