C++ read int array with libpqxx

From: alexandros_e <alexandros(dot)ef(at)gmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: C++ read int array with libpqxx
Date: 2014-03-07 20:38:47
Message-ID: 1394224727721-5795212.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hello experts,

I want to retrieve integer arrays (type integer[]) from Postgres DB through
C++ and libpqxx. Older posts (2007) suggest to read the array as string and
make a custom function that parses the text representation '{1,2,3}' and
then get the integer values. Has anything improved on this matter? Can I
actually get the integer array directly?

If not should I do "SELECT id, myIntegerArrayField FROM DBTable" within C++
or I should first do the text conversion from SQL like "SELECT id,
array_to_string(myIntegerArrayField,',') FROM DBTable" and then parse the
string returned.

I appreciate your feedback.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/C-read-int-array-with-libpqxx-tp5795212.html
Sent from the PostgreSQL - interfaces mailing list archive at Nabble.com.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Vernon E 2014-03-11 21:54:36 Which Java class in the new java.time package shall be used to mapped timestamp?
Previous Message Karthik Segpi 2014-02-27 13:17:29 PQunescapebytea not reverse of PQescapebytea?