Re: JDBC build patches

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: JDBC build patches
Дата
Msg-id Pine.LNX.4.30.0103142301530.1211-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: JDBC build patches  (Peter Mount <peter@retep.org.uk>)
Список pgsql-jdbc
Peter Mount writes:

> > > So far our standard has been to use 5432 if no port is supplied.
> >
> >It's still this way.  As I said, only people that use configure
> >--with-pgport see any change, and those people know what they're getting
> >into.
>
> Perhaps a message saying this (or even in the version strings within JDBC).

Version string sounds okay.  A message during the build would probably get
lost.

How about this patch:

diff -u -r1.5 Driver.java.in
--- Driver.java.in      2001/03/11 11:07:01     1.5
+++ Driver.java.in      2001/03/14 21:47:09
@@ -214,7 +214,13 @@
      */
     public static String getVersion()
     {
-       return "@VERSION@";
+        String version = "@VERSION@";
+       String defport = defaultPort();
+
+        if (defport == "5432")
+            return version;
+        else
+            return version + " (default port " + defport + ")";
     }

   /**
@@ -350,8 +356,13 @@
    * @return the port number portion of the URL or -1 if no port was specified
    */
   public int port()
+  {
+    return Integer.parseInt(props.getProperty("PGPORT", defaultPort()));
+  }
+
+  private String defaultPort()
   {
-    return Integer.parseInt(props.getProperty("PGPORT","@DEF_PGPORT@"));
+    return "@DEF_PGPORT@";
   }

   /**

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


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

Предыдущее
От: Corey Mosher
Дата:
Сообщение: RE: JDBC Errors
Следующее
От: selvam@gelife.com.my
Дата:
Сообщение: PostgresSQL and JDBC