Re: Use C++ to iterate integer array returned from stored procedure

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
Cc: Yan Cheng Cheok <yccheok(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Use C++ to iterate integer array returned from stored procedure
Date: 2010-01-07 17:12:11
Message-ID: b42b73151001070912t587b6f36ubf847f09e548d6d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 7, 2010 at 11:30 AM, Peter Geoghegan
<peter(dot)geoghegan86(at)gmail(dot)com> wrote:
> I suggest that you use libpqxx. libpqxx already has a utility template
> function called separated_list() that lives in the pqxx namespace for
> converting std containers into array literals. It also has a function
> template called "from_string" that lives in the same place. I imagine
> it's implemented in terms of stringstream though (otherwise, JTV would
> have written a bunch of specialisations or overloads), and as such is
> highly generic and unlikely to do what you want (I've just taken a
> look at the doxygen generated docs on pqxx.org, I cannot confirm that
> right now).
>
> In any case, you are better of with pqxx. You can make some noise on
> the pqxx mailing list if you feel that it ought to have this
> functionality.

libpqxx is good, but libpqtypes handling of arrays and composites is
far superior. honestly, libpqxx might want to consider wrapping
libpqtypes to bring full support for arrays into the library
(libpqtypes has solved this
(http://pqxx.org/development/libpqxx/ticket/97). Also libpqtypes has
no C++ dependency, and routes all data via binary which is much faster
for arrays.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma 2010-01-07 17:48:52 Writable CTE queries
Previous Message Joe Conway 2010-01-07 17:02:25 Re: PostgreSQL Write Performance