Patch from Barry Lind to correctly decode time zones in timestamp results.
authorThomas G. Lockhart <[email protected]>
Tue, 22 May 2001 14:46:46 +0000 (14:46 +0000)
committerThomas G. Lockhart <[email protected]>
Tue, 22 May 2001 14:46:46 +0000 (14:46 +0000)
 Without patch, the time zone field is ignored and the returned time is
 not correct.
 Already applied to the development tree...

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

index 561614b33abec0704e22d6a4efa80659e62a05e0..4b988a3e4fa5f7996024d66e5ac5f1a80b05019e 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");