From: gar8@pitt.edu
To: pgsql-sql@postgresql.org
Subject: How can I pass an array from PostgreSQL to C (libpq)?
Date: 26 Mar 2003 10:24:46 -0800
Message-ID: <a1688e61.0303261024.38b1b31e@posting.google.com> (raw)
I'm using the C library (lipq) to grab data from a field that contains
a float array (float4[]). I'd like to fill an array in my C program
with these values. Unfortunately, Postgres returns the array as a
large string instead of individual values.
Now I could perform "select array_var[1], array_var[2], array_var[3],
..., array_var[4]" and have each array value come back as a different
field, but this seems fairly messy. I suppose I could also go through
and parse the characters in the string returned.
Has anyone else used any other strategies to fill their C array with
an array returned from the libpq? Perhaps there are some SQL functions
for arrays that might exist?
Thanks.
-Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gar8@pitt.edu
Subject: Re: How can I pass an array from PostgreSQL to C (libpq)?
In-Reply-To: <a1688e61.0303261024.38b1b31e@posting.google.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox