From e70b4831d7f5c22d7d68bc7bb5d14a0a3554c3e6 Mon Sep 17 00:00:00 2001 From: Peter Mount Date: Sun, 27 Jun 1999 11:05:38 +0000 Subject: Some minor bug fixes --- .../jdbc/postgresql/jdbc2/ResultSet.java | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java') diff --git a/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/postgresql/jdbc2/ResultSet.java index 0e8b661d232..97fde4a78ce 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); + } } /** -- cgit v1.2.3