Patch for jdbc ResultSet.getTimestamp()
От | Barry Lind |
---|---|
Тема | Patch for jdbc ResultSet.getTimestamp() |
Дата | |
Msg-id | 3B021563.7060809@xythos.com обсуждение исходный текст |
Ответы |
Re: Patch for jdbc ResultSet.getTimestamp()
Re: Patch for jdbc ResultSet.getTimestamp() |
Список | pgsql-patches |
Included is a patch that fixes a bug introduced in the lastest version (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. If possible this patch should be patched into 7.1 for the upcoming 7.1.2 patch. thanks, --Barry *** ./interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java.orig Tue May 15 21:59:46 2001 --- ./interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java Tue May 15 22:06:43 2001 *************** *** 499,511 **** // could optimize this a tad to remove too many object creations... SimpleDateFormat df = null; ! if (s.length()>23 && subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSzzzzzzzzz"); ! } else if (s.length()>23 && !subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz"); ! } else if (s.length()>10 && subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); ! } else if (s.length()>10 && !subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); } else { df = new SimpleDateFormat("yyyy-MM-dd"); --- 499,511 ---- // could optimize this a tad to remove too many object creations... SimpleDateFormat df = null; ! if (sbuf.length()>23 && subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSzzzzzzzzz"); ! } else if (sbuf.length()>23 && !subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzzzzzzzz"); ! } else if (sbuf.length()>10 && subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); ! } else if (sbuf.length()>10 && !subsecond) { df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); } else { df = new SimpleDateFormat("yyyy-MM-dd");
В списке pgsql-patches по дате отправления: