This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to tag REL8_0_315 in repository libpostgresql-jdbc-java.
commit c7f5665374658fc09cb6aba5b95fc11e18535ea8 Author: Kris Jurka <[email protected]> Date: Thu Dec 15 23:29:39 2005 +0000 The V2 protocol wasn't correctly handling EmptyQuery messages. It expected a four byte message length after the EmptyQuery message, but there is only a single null byte sent by the backend. --- org/postgresql/core/v2/QueryExecutorImpl.java | 7 ++++--- org/postgresql/test/jdbc2/StatementTest.java | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/org/postgresql/core/v2/QueryExecutorImpl.java b/org/postgresql/core/v2/QueryExecutorImpl.java index 95ad0ca..3f59793 100644 --- a/org/postgresql/core/v2/QueryExecutorImpl.java +++ b/org/postgresql/core/v2/QueryExecutorImpl.java @@ -4,7 +4,7 @@ * Copyright (c) 2004, Open Cloud Limited. * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/core/v2/QueryExecutorImpl.java,v 1.10.2.1 2005/02/10 19:52:45 jurka Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/core/v2/QueryExecutorImpl.java,v 1.10.2.2 2005/02/15 08:55:50 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -443,8 +443,9 @@ public class QueryExecutorImpl implements QueryExecutor { case 'I': // Empty Query if (Driver.logDebug) Driver.debug(" <=BE EmptyQuery"); - /* discard */ - pgStream.ReceiveIntegerR(4); + c = pgStream.ReceiveChar(); + if (c != 0) + throw new IOException("Expected \\0 after EmptyQuery, got: " + c); break; case 'N': // Error Notification diff --git a/org/postgresql/test/jdbc2/StatementTest.java b/org/postgresql/test/jdbc2/StatementTest.java index d033462..79c0f87 100644 --- a/org/postgresql/test/jdbc2/StatementTest.java +++ b/org/postgresql/test/jdbc2/StatementTest.java @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/StatementTest.java,v 1.15.2.1 2005/08/12 18:22:31 jurka Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/StatementTest.java,v 1.15.2.2 2005/11/05 09:27:56 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -94,6 +94,14 @@ public class StatementTest extends TestCase stmt.close(); } + public void testEmptyQuery() throws SQLException + { + Statement stmt = con.createStatement(); + stmt.execute(""); + assertNull(stmt.getResultSet()); + assertTrue(!stmt.getMoreResults()); + } + public void testUpdateCount() throws SQLException { Statement stmt = con.createStatement(); -- 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

