This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to tag REL8_1_409 in repository libpostgresql-jdbc-java.
commit 4ce86879974df85460c9a98aba2f820eab14c56c Author: Kris Jurka <[email protected]> Date: Fri Jan 5 00:34:20 2007 +0000 Produce the timezone that we send to the server in the same format that we can parse. This is important for updatable ResultSets as we must be able to parse the format we produce. Reported by Leon Do --- org/postgresql/jdbc2/TimestampUtils.java | 4 +++- .../test/jdbc2/UpdateableResultTest.java | 27 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/org/postgresql/jdbc2/TimestampUtils.java b/org/postgresql/jdbc2/TimestampUtils.java index 40b61a0..b9075c1 100644 --- a/org/postgresql/jdbc2/TimestampUtils.java +++ b/org/postgresql/jdbc2/TimestampUtils.java @@ -3,7 +3,7 @@ * Copyright (c) 2003-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/TimestampUtils.java,v 1.18 2005/10/25 22:44:27 davec Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/TimestampUtils.java,v 1.18.2.1 2006/04/29 02:33:52 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -546,6 +546,8 @@ public class TimestampUtils { sb.append('0'); sb.append(hours); + sb.append(':'); + if (mins < 10) sb.append('0'); sb.append(mins); diff --git a/org/postgresql/test/jdbc2/UpdateableResultTest.java b/org/postgresql/test/jdbc2/UpdateableResultTest.java index 782acc1..43c199e 100644 --- a/org/postgresql/test/jdbc2/UpdateableResultTest.java +++ b/org/postgresql/test/jdbc2/UpdateableResultTest.java @@ -3,7 +3,7 @@ * Copyright (c) 2001-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java,v 1.21 2005/07/04 18:50:30 davec Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java,v 1.22 2005/09/29 22:13:25 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,7 @@ import java.io.ByteArrayInputStream; import java.io.Reader; import java.io.StringReader; import java.io.UnsupportedEncodingException; +import java.util.TimeZone; import org.postgresql.test.TestUtil; @@ -38,7 +39,7 @@ public class UpdateableResultTest extends TestCase protected void setUp() throws Exception { con = TestUtil.openDB(); - TestUtil.createTable(con, "updateable", "id int primary key, name text, notselected text", true); + TestUtil.createTable(con, "updateable", "id int primary key, name text, notselected text, ts timestamp with time zone", true); TestUtil.createTable(con, "second", "id1 int primary key, name1 text"); TestUtil.createTable(con, "stream", "id int primary key, asi text, chr text, bin bytea"); @@ -192,6 +193,28 @@ public class UpdateableResultTest extends TestCase stmt.close(); } + public void testUpdateTimestamp() throws SQLException + { + TimeZone origTZ = TimeZone.getDefault(); + try { + // We choose a timezone which has a partial hour portion + // Asia/Tehran is +3:30 + TimeZone.setDefault(TimeZone.getTimeZone("Asia/Tehran")); + Timestamp ts = Timestamp.valueOf("2006-11-20 16:17:18"); + + Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = stmt.executeQuery("SELECT id, ts FROM updateable"); + rs.moveToInsertRow(); + rs.updateInt(1,1); + rs.updateTimestamp(2,ts); + rs.insertRow(); + rs.first(); + assertEquals(ts, rs.getTimestamp(2)); + } finally { + TimeZone.setDefault(origTZ); + } + } + public void testUpdateStreams() throws SQLException, UnsupportedEncodingException { Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

