From: Jim Parker <hopeye@cfl.rr.com>
To: PostgreSQL mailing list <pgsql-interfaces@postgresql.org>
Subject: ECPG Questions
Date: Thu, 11 Jul 2002 11:01:27 -0400
Message-ID: <200207111501.g6BF1Ro0011306@smtp-server1.tampabay.rr.com> (raw)
G'Day !
I am writing an application that intefaces with a POstgreSQL database thru
ECPG.
One of my queries is rather complex involving 4+ tables. One table has an
arbitrary number of items associated with a single entry on another table.
It is actually a many to many relationship. I am using a "index" table to
relate the two.
For example: I have a table that contains an id plus other information
then a second table that contains an id as a foriegn key plus an arbitray
number of data points. the two table are associated with an index table.
I want to retrieve the data and put it into a linked list of structs, the
data points in an
array inside the struct.
Is there an easy way to do this.
I was think that I would open a cursor to get the info from the first table
(which includes a column for number of data points) Then allocate an array
and open a second cursor to retrieve the data points, then put all the data
into a list element and move to the next truple.
Is this legal ? Is there a better way ?
The alternative is to get all the data in one large truple and throw away
all the repetive data returned. This seems like an unneeded headache.
comments and suggestions
cheers,
Jim Parker
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: hopeye@cfl.rr.com
Subject: Re: ECPG Questions
In-Reply-To: <200207111501.g6BF1Ro0011306@smtp-server1.tampabay.rr.com>
* 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