diff --git a/src/interfaces/jdbc/CHANGELOG b/src/interfaces/jdbc/CHANGELOG index 3fc584b00e00c81e1169799611ade04003db3bc0..830e942b1402d78f4abe0f8467272f79e1716f3d 100644 --- a/src/interfaces/jdbc/CHANGELOG +++ b/src/interfaces/jdbc/CHANGELOG @@ -1,3 +1,9 @@ +Sun Jun 27 12:00:00 BST 1999 + - Fixed typo in postgresql.Driver that prevented compilation + - Implemented getTimestamp() fix submitted by Philipp Matthias Hahn + <pmhahn@titan.lahn.de> + - Cleaned up some comments in Connection + Wed Jun 23 06:50:00 BST 1999 - Fixed error in errors.properties where the arguments are 0 based not 1 based diff --git a/src/interfaces/jdbc/postgresql/Driver.java b/src/interfaces/jdbc/postgresql/Driver.java index 2c78b614bad10b2c31728e82daaab47a1586682f..06c890309790228565f9414fe6510a120ea35257 100644 --- a/src/interfaces/jdbc/postgresql/Driver.java +++ b/src/interfaces/jdbc/postgresql/Driver.java @@ -104,7 +104,7 @@ public class Driver implements java.sql.Driver return (java.sql.Connection)con; } catch(ClassNotFoundException ex) { throw new PSQLException("postgresql.jvm.version",ex); - } catch(PSQLException(ex1) { + } catch(PSQLException ex1) { // re-throw the exception, otherwise it will be caught next, and a // postgresql.unusual error will be returned instead. throw ex1; diff --git a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java index fca14e64d92fb01ad960075d00aa24549956a856..1ee24a8e29f7179775ca7cf8d35bcb2ddb9debc3 100644 --- a/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java +++ b/src/interfaces/jdbc/postgresql/jdbc1/ResultSet.java @@ -434,24 +434,16 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe public Timestamp getTimestamp(int columnIndex) throws SQLException { String s = getString(columnIndex); + if(s==null) + return null; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzz"); - if (s != null) - { - int TZ = new Float(s.substring(19)).intValue(); - TZ = TZ * 60 * 60 * 1000; - TimeZone zone = TimeZone.getDefault(); - zone.setRawOffset(TZ); - String nm = zone.getID(); - s = s.substring(0,19) + nm; - try { - java.util.Date d = df.parse(s); - return new Timestamp(d.getTime()); - } catch (ParseException e) { - throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s); - } - } - return null; // SQL NULL + try { + return new Timestamp(df.parse(s).getTime()); + } catch(ParseException e) { + throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s); + } } /** diff --git a/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java index 0e8b661d232cba2ca4b0d9ceb54e0c27d98d8901..97fde4a78ce84d3a5a6f394d1b4a0d5d92668144 100644 --- a/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java +++ b/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java @@ -436,24 +436,16 @@ public class ResultSet extends postgresql.ResultSet implements java.sql.ResultSe public Timestamp getTimestamp(int columnIndex) throws SQLException { String s = getString(columnIndex); + if(s==null) + return null; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzz"); - if (s != null) - { - int TZ = new Float(s.substring(19)).intValue(); - TZ = TZ * 60 * 60 * 1000; - TimeZone zone = TimeZone.getDefault(); - zone.setRawOffset(TZ); - String nm = zone.getID(); - s = s.substring(0,19) + nm; - try { - java.util.Date d = df.parse(s); - return new Timestamp(d.getTime()); - } catch (ParseException e) { - throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s); - } - } - return null; // SQL NULL + try { + return new Timestamp(df.parse(s).getTime()); + } catch(ParseException e) { + throw new PSQLException("postgresql.res.badtimestamp",new Integer(e.getErrorOffset()),s); + } } /**