pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sean Davis <sdavis2@mail.nih.gov>
To: pgsql-interfaces@postgresql.org
Cc: Andreas Gidlund <vaxis@hotmail.com>
Subject: Re: Retrieve all the returned rows in one call
Date: Mon, 9 Oct 2006 11:30:06 -0400
Message-ID: <200610091130.06335.sdavis2@mail.nih.gov> (raw)
In-Reply-To: <BAY103-F23CEDEF25EEDE7CAFCE5F9BA160@phx.gbl>
References: <BAY103-F23CEDEF25EEDE7CAFCE5F9BA160@phx.gbl>

On Monday 09 October 2006 10:58, Andreas Gidlund wrote:
> I am right now using the libpq interface and struggling with efficiently
> retrieve the result from a query.
>
> Let's say I run a select statement with some where clauses and then
> retrieve the result into a PGresult. I want to know if there is an
> efficient way to retrieve all the rows at once? I am going to return a
> char*** from my function, i.e. a two-dimensional array of char pointers.
> I have seen the COPY sql command, but up to v8.1 i cannot use a select
> statement with it, the only way to customize COPY is to choose which
> columns to return, but still, the only option is to return the whole table.
> Furthermore, when using PQgetCopyData I get the whole row at once, but I
> still have to loop through all rows.
> I have also seen in the PGresult structure that it has a member called
> tuples, which is a two-dimensional array of the structure PGresAttValue.
> This is a way to recieve all the data at once, but it is in a format which
> is specific for PostgreSQL and I am developing a database interface
> including other databases two, so I want to use a general structure
> returned from the function, i.e. a char***. This means that I would have to
> loop through the tuples array to convert into the char array structure, and
> hence lose the whole meaning with recieving all the rows at once.
>
> So my question is if it is possible in any way to retrieve the result in
> the form of char***?

I think the answer is no.  

Sean



view thread (2+ messages)

Message-ID: <200610091130.06335.sdavis2@mail.nih.gov>
Permalink:  ../200610091130.06335.sdavis2@mail.nih.gov/
Also on:    postgresql.org/message-id/200610091130.06335.sdavis2@mail.nih.gov

 · 

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: sdavis2@mail.nih.gov, vaxis@hotmail.com
  Subject: Re: Retrieve all the returned rows in one call
  In-Reply-To: <200610091130.06335.sdavis2@mail.nih.gov>

* 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