Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-interfaces by date

Next:From: Tom LaneDate: 2006-06-07 17:20:02
Subject: Re: libpq PQexecParams and arrays
Previous:From: Keary SuskaDate: 2006-06-07 16:05:32
Subject: Re: libpq PQexecParams and arrays

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group