pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alf Lewerken <lewerken@mail.bicos.de>
To: pgsql-interfaces@postgreSQL.org
Subject: libpq++ and arrays?
Date: Fri, 14 May 1999 23:07:56 +0200
Message-ID: <000f01be9e4d$d7cc1860$0700000a@sgi320.lewerkenedv.de> (raw)

Hi all

I have the following problem:
I'm using libpq++ to acces a Postgres-Database.

The table was created in psql using:
create table test values (nr int4, some_value float4[]);

in my C++-program a piece of code is:

main()
{
  char *nr_string, *some_other_string;

  PgDatabase test(pgenv, "test");
  test.Exec("begin");
  test.Exec("declare c cursor for select * from test");
  
  for(int i=0; i<test.Tuples();i++)
  {
     nr_string = test.GetValue(i, "nr");  // obtaining the value in 'nr' is easy

     some_other_string = test.GetValue(i, "some_value[1]"); // this gives an error
     // PQgetvalue: ERROR! field number -1 is out of range
   
     // so how do I obtain values in some_value[1], some_value[2] .... ?
  }
}

any help would be appreciated.


bye


Alf Lewerken

view thread (3+ messages)  latest in thread

Message-ID: <000f01be9e4d$d7cc1860$0700000a@sgi320.lewerkenedv.de>
Permalink:  ../000f01be9e4d$d7cc1860$0700000a@sgi320.lewerkenedv.de/
Also on:    postgresql.org/message-id/000f01be9e4d$d7cc1860$0700000a@sgi320.lewerkenedv.de

 · 

reply

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-interfaces@postgresql.org
  Cc: lewerken@mail.bicos.de
  Subject: Re: libpq++ and arrays?
  In-Reply-To: <000f01be9e4d$d7cc1860$0700000a@sgi320.lewerkenedv.de>

* 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