]> granicus.if.org Git - postgresql/commitdiff
Included is a patch that fixes a bug introduced in the lastest version
authorBruce Momjian <bruce@momjian.us>
Thu, 17 May 2001 04:10:02 +0000 (04:10 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 17 May 2001 04:10:02 +0000 (04:10 +0000)
(1.22) of interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java.  That
change removed a line that set the variable s to the value of the
stringbuffer.   This fix changes the following if checks to check the
length of the stringbuffer instead of s, since s no longer contains the
string the if conditions are expecting.

The bug manifests itself in getTimestamp() loosing the timezone
information of timestamps selected from the database, thereby causing
the time to be incorrect.

Barry Lind

src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java

index aae8cf6ff26bd183d0542f9b6a301757ce5ad9b9..467476f833ce2f5b76644e1853cee7c3a32da379 100644 (file)
@@ -488,13 +488,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
 
     SimpleDateFormat df = null;
 
-    if (s.length()>23 && subsecond) {
+    if (sbuf.length()>23 && subsecond) {
       df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSzzzzzzzzz");
-    } else if (s.length()>23 && !subsecond) {
+    } else if (sbuf.length()>23 && !subsecond) {
       df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz");
-    } else if (s.length()>10 && subsecond) {
+    } else if (sbuf.length()>10 && subsecond) {
       df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-    } else if (s.length()>10 && !subsecond) {
+    } else if (sbuf.length()>10 && !subsecond) {
       df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     } else {
       df = new SimpleDateFormat("yyyy-MM-dd");
index 54865d8e3f7e36259e638f2bfbde9c6c1ece0192..7aebd950b0012e64a78b53c67f4d4fabf9ae66b4 100644 (file)
@@ -499,13 +499,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
       // could optimize this a tad to remove too many object creations...
       SimpleDateFormat df = null;
 
-      if (s.length()>23 && subsecond) {
+      if (sbuf.length()>23 && subsecond) {
         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSzzzzzzzzz");
-      } else if (s.length()>23 && !subsecond) {
+      } else if (sbuf.length()>23 && !subsecond) {
         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz");
-      } else if (s.length()>10 && subsecond) {
+      } else if (sbuf.length()>10 && subsecond) {
         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-      } else if (s.length()>10 && !subsecond) {
+      } else if (sbuf.length()>10 && !subsecond) {
         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       } else {
         df = new SimpleDateFormat("yyyy-MM-dd");