Re: Doubt more info

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Doubt more info
Дата
Msg-id 1022770764.1427.76.camel@inspiron.cramers
обсуждение исходный текст
Ответ на Re: Doubt  (Dave Cramer <Dave@micro-automation.net>)
Список pgsql-jdbc
The following works on the current CVS code. Can someone verify that it
works on the latest release.

  public void testForeignKeys()
  {
        try
        {
          Connection con1 = JDBC2Tests.openDB();
          JDBC2Tests.createTable( con1, "people", "id int4 primary key, name
text" );
          JDBC2Tests.createTable( con1, "policy", "id int4 primary key, name
text" );
          JDBC2Tests.createTable( con1, "users", "id int4 primary key,
people_id int4, policy_id int4,"+
                                    "CONSTRAINT people FOREIGN KEY
(people_id) references people(id),"+
                                    "constraint policy FOREIGN KEY
(policy_id) references policy(id)" );


            DatabaseMetaData dbmd = con.getMetaData();
            assertNotNull(dbmd);

      ResultSet rs = dbmd.getImportedKeys(null, "", "users" );

      while ( rs.next() )
      {
        for ( int i=0; i < 14 ; i++ )
        {
          System.out.print( rs.getString(i+1) + ' ' );
        }
        System.out.println();
      }
      JDBC2Tests.dropTable( con1, "users" );
      JDBC2Tests.dropTable( con1, "people" );
      JDBC2Tests.dropTable( con1, "policy" );

        }
        catch (SQLException ex)
        {
            fail(ex.getMessage());
        }
  }


Dave

On Thu, 2002-05-30 at 08:53, Dave Cramer wrote:
> Actually, this is the second time I have heard this, so I am leaning
> towards this being a bug.
>
> Dave
> On Thu, 2002-05-30 at 06:20, Joe Shevland wrote:
> > Hi Priya,
> >
> > Unsure, as I don't tend to use the metadata methods a lot, but it may be the case that the latest CVS sources of
thedriver have solved the problem. I've CC'ed the main list as I'm fairly sure this has come up before and is working. 
> >
> > Cheers,
> > Joe
> >
> > -----Original Message-----
> > From: priya k [mailto:k_priya17@yahoo.com]
> > Sent: Thursday, 30 May 2002 19:57
> > To: Joe Shevland
> > Subject: RE: Doubt
> >
> >  Thank you for the immediate reply.
> > I downloaded & tried retrieving primary key, foreign key(namely getExported, getImportedKey). Both of them are
working,but getImportedKey is able to retrieve only one foreign key , eventhough the table has 2. Sir, what to do ?  
> >                            Waiting for ur reply,
> >                                                                                 With regards,
> >                                                                                                  Priya.
> >
> >
> >   Joe Shevland <jshevland@j-elite.com> wrote:
> > Hi there,
> >
> > These metadata methods will work with the latest versions of the PostgreSQL JDBC driver.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
> >
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Doubt
Следующее
От: Noel Rappin
Дата:
Сообщение: Issues with Array interface?