Re: JDBC build patches - Mailing list pgsql-jdbc

From Peter Eisentraut
Subject Re: JDBC build patches
Date
Msg-id Pine.LNX.4.30.0103142301530.1211-100000@peter.localdomain
Whole thread Raw
In response to Re: JDBC build patches  (Peter Mount <peter@retep.org.uk>)
List 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 by date:

Previous
From: Corey Mosher
Date:
Subject: RE: JDBC Errors
Next
From: selvam@gelife.com.my
Date:
Subject: PostgresSQL and JDBC