Re: tough one - Mailing list pgsql-jdbc

From John Anderson
Subject Re: tough one
Date
Msg-id 4.2.0.58.20010810195504.00a893e0@frank
Whole thread Raw
In response to tough one  (Tony Grant <tony@animaproductions.com>)
List pgsql-jdbc
At 16:51 2001/08/09 +0200, Tony Grant wrote:
>festival        | filmid
>------------------------------------------
>1979            | 102, 103, 104
>1980            | 258, 369, 489, 568
>
>How can I simulate an ARRAY of this type? If I can't - where is the
>nearest bridge?

you could define a table with this data:

festival        | filmid
------------------------------------------
1979            | 102
1979            | 103
1979            | 104
1980            | 258
1980            | 369
1980            | 489
1980            | 568

with a query like this:

select filmid from films where festival = '1980'

and use a loop like this to generate an array

Vector films = new Vector();
while ( rs.next() )
{
         films.add ( rs.getString ( "filmid" ) );
}

bye
John


pgsql-jdbc by date:

Previous
From: Gunnar Rønning
Date:
Subject: Re: Which JDK to build jdbc1 driver on Linux?
Next
From: Bryan Field-Elliot
Date:
Subject: How to read PG Circle and Point types from JDBC?