Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id EE5CF9FB68E for ; Mon, 9 Oct 2006 11:58:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 39397-09 for ; Mon, 9 Oct 2006 11:58:09 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from bay0-omc3-s37.bay0.hotmail.com (bay0-omc3-s37.bay0.hotmail.com [65.54.246.237]) by postgresql.org (Postfix) with ESMTP id BE0489FB68B for ; Mon, 9 Oct 2006 11:58:08 -0300 (ADT) Received: from hotmail.com ([65.54.174.33]) by bay0-omc3-s37.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 9 Oct 2006 07:58:06 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 9 Oct 2006 07:58:06 -0700 Message-ID: Received: from 65.54.174.200 by by103fd.bay103.hotmail.msn.com with HTTP; Mon, 09 Oct 2006 14:58:05 GMT X-Originating-IP: [189.163.163.241] X-Originating-Email: [vaxis@hotmail.com] X-Sender: vaxis@hotmail.com From: "Andreas Gidlund" To: pgsql-interfaces@postgresql.org Subject: Retrieve all the returned rows in one call Date: Mon, 09 Oct 2006 16:58:05 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed X-OriginalArrivalTime: 09 Oct 2006 14:58:06.0961 (UTC) FILETIME=[541EB610:01C6EBB3] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.907 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER, SPF_PASS X-Spam-Level: * X-Archive-Number: 200610/3 X-Sequence-Number: 6286 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***? _________________________________________________________________ Gör karriär! http://monster.msn.se/