X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BBFA232A4B9 for ; Mon, 4 Oct 2004 04:45:34 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52660-10 for ; Mon, 4 Oct 2004 03:45:25 +0000 (GMT) Received: from web40626.mail.yahoo.com (web40626.mail.yahoo.com [66.218.92.55]) by svr1.postgresql.org (Postfix) with SMTP id 42D8A32A4B8 for ; Mon, 4 Oct 2004 04:45:18 +0100 (BST) Message-ID: <20041004034512.387.qmail@web40626.mail.yahoo.com> Received: from [24.16.99.0] by web40626.mail.yahoo.com via HTTP; Sun, 03 Oct 2004 20:45:12 PDT Date: Sun, 3 Oct 2004 20:45:12 -0700 (PDT) From: Brett Schwarz Subject: Re: Array elements (urgent help needed) To: Akbar Mokhtarani , PostgreSQL-interfaces In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/7 X-Sequence-Number: 5102 I really haven't work with arrays that much at the C level, but I thought that the result from PQgetvalue was just a char string. If it is an array, I thought that the string would look like: {elem1, elem2, elem3, ...}. I don't think there are any helper functions for this, so you need to manually walk that char string to peel out the elements...at least as far as I am aware. You might want to look at the how the operators for arrays access the elements, e.g. the <> operator for arrays. Again, I'm not expert, but this is what I had thought is the case. I hope I understood your question. HTH, --brett --- Akbar Mokhtarani wrote: > I am desparate to find a way to access array > elements from my c/c++ > program. I have stored int and double data as arrays > in my tables and need > to retrieve them from the database. I use a binary > cursor to store the > query results and PQgetvalue gives me a char* > pointer to the storage area > where the data is stored (this is according to the > documentation). I have > tried to understand the internal structure of the > storage area, but it > changes with data type. I suspect there is a more > reliable/elegant way to > get access to the elements. What is the correct way > of doing this? > > Thanks in advance. > > Akbar Mokhtarani > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >