Re: libpq PQexecParams and arrays

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Alexey Slynko <slynko(at)tronet(dot)ru>
Cc: Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq PQexecParams and arrays
Date: 2006-06-07 16:05:32
Message-ID: C0AC556C.2B270%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

on 6/7/06 2:54 AM, slynko(at)tronet(dot)ru purportedly said:

>>> I wish to call PQexecParams with array of uint32_t values.
>>> I've tried to use example from src/test/examples/testlibpq3.c, but with
>>> no effect - it's unusable for input array.
>>>
>>> Have anyone an idea, how it can be done?
>>
>> Have you tried passing all parameters, including especially the appropriate
>> paramTypes and paramFormats parameters?
> Of course
>
>> I believe that doing this should
>> permit libpq to understand binary data.
> No, it doesn't.
> I've found, that array parsed at the server side by array_recv function.
> Is there is a way to send an array of arbitrary type by libpq?

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 it is just a matter of passing binary numeric values, I thought it was
supported by libpq, but maybe not. The documentation is ambiguous in many
places, so it is possible that libpq's binary support is only for blobs and
not for other data types.

I have never tried passing binary data, as I tend to find it easier in my
applications to pass textual representations, so I can't say for sure.

You may have to "convert" your int array into an array of char.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2006-06-07 16:39:04 Re: libpq PQexecParams and arrays
Previous Message Keary Suska 2006-06-06 23:35:48 Re: libpq PQexecParams and arrays