This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to tag REL8_0_320 in repository libpostgresql-jdbc-java.
commit 90694f4d301927653016e808cdc06c11bf92494c Author: Kris Jurka <[email protected]> Date: Fri Jul 27 09:02:04 2007 +0000 Do escape processing on batch Statements prior to execution. This already worked for PreparedStatements, but not plain Statements. Reported by Hui Ye --- org/postgresql/jdbc2/AbstractJdbc2Statement.java | 4 +++- org/postgresql/test/jdbc2/BatchExecuteTest.java | 25 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/org/postgresql/jdbc2/AbstractJdbc2Statement.java index b8c59a1..3f4e4c8 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Statement.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Statement.java @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.68.2.13 2006/09/26 04:42:31 jurka Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.68.2.14 2007/06/22 21:37:53 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -2366,6 +2366,8 @@ public abstract class AbstractJdbc2Statement implements BaseStatement batchParameters = new ArrayList(); } + p_sql = replaceProcessing(p_sql); + batchStatements.add(connection.getQueryExecutor().createSimpleQuery(p_sql)); batchParameters.add(null); } diff --git a/org/postgresql/test/jdbc2/BatchExecuteTest.java b/org/postgresql/test/jdbc2/BatchExecuteTest.java index bd1eddb..0641339 100644 --- a/org/postgresql/test/jdbc2/BatchExecuteTest.java +++ b/org/postgresql/test/jdbc2/BatchExecuteTest.java @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java,v 1.12 2005/01/11 08:25:48 jurka Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java,v 1.12.2.1 2005/08/12 18:22:31 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -253,4 +253,27 @@ public class BatchExecuteTest extends TestCase stmt.close(); } + public void testBatchEscapeProcessing() throws SQLException + { + Statement stmt = con.createStatement(); + stmt.execute("CREATE TEMP TABLE batchescape (d date)"); + + stmt.addBatch("INSERT INTO batchescape (d) VALUES ({d '2007-11-20'})"); + stmt.executeBatch(); + + PreparedStatement pstmt = con.prepareStatement("INSERT INTO batchescape (d) VALUES ({d '2007-11-20'})"); + pstmt.addBatch(); + pstmt.executeBatch(); + pstmt.close(); + + ResultSet rs = stmt.executeQuery("SELECT d FROM batchescape"); + assertTrue(rs.next()); + assertEquals("2007-11-20", rs.getString(1)); + assertTrue(rs.next()); + assertEquals("2007-11-20", rs.getString(1)); + assertTrue(!rs.next()); + rs.close(); + stmt.close(); + } + } -- 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

