This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to annotated tag REL9_3_1102 in repository libpostgresql-jdbc-java.
commit 1501cbb13ad2a1ad890293c2c87e9b5f160ef6e6 Author: Dave Cramer <[email protected]> Date: Wed Apr 23 10:36:35 2014 -0400 binary transfer fixes new feature -1 for forceBinaryTransfer --- org/postgresql/jdbc2/AbstractJdbc2Connection.java | 4 +++- org/postgresql/jdbc2/AbstractJdbc2Statement.java | 18 +++++++++--------- org/postgresql/test/jdbc2/ServerPreparedStmtTest.java | 5 +++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/org/postgresql/jdbc2/AbstractJdbc2Connection.java b/org/postgresql/jdbc2/AbstractJdbc2Connection.java index d9ef7c3..50bf03a 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Connection.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Connection.java @@ -119,12 +119,14 @@ public abstract class AbstractJdbc2Connection implements BaseConnection try { prepareThreshold = Integer.parseInt(info.getProperty("prepareThreshold", "5")); - if (prepareThreshold < 0) + // special value to set forceBinary to true + if (prepareThreshold == -1) forcebinary = true; } catch (Exception e) { } + boolean binaryTransfer = true; try { diff --git a/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/org/postgresql/jdbc2/AbstractJdbc2Statement.java index 3580257..6c6d473 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Statement.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Statement.java @@ -39,7 +39,7 @@ import org.postgresql.util.GT; public abstract class AbstractJdbc2Statement implements BaseStatement { // only for testing purposes. even single shot statements will use binary transfers - public static boolean ForceBinaryTransfers = Boolean.getBoolean("org.postgresql.forcebinary"); + public boolean forceBinaryTransfers = Boolean.getBoolean("org.postgresql.forcebinary"); protected ArrayList batchStatements = null; protected ArrayList batchParameters = null; @@ -145,7 +145,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement this.preparedQuery = null; this.preparedParameters = null; this.lastSimpleQuery = null; - ForceBinaryTransfers |= c.getForceBinary(); + forceBinaryTransfers |= c.getForceBinary(); resultsettype = rsType; concurrency = rsConcurrency; } @@ -166,7 +166,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement this.testReturn = new int[inParamCount]; this.functionReturnType = new int[inParamCount]; - ForceBinaryTransfers |= connection.getForceBinary(); + forceBinaryTransfers |= connection.getForceBinary(); resultsettype = rsType; concurrency = rsConcurrency; @@ -261,7 +261,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement throw new PSQLException(GT.tr("Can''t use query methods that take a query string on a PreparedStatement."), PSQLState.WRONG_OBJECT_TYPE); - if (ForceBinaryTransfers) { + if (forceBinaryTransfers) { clearWarnings(); // Close any existing resultsets associated with this statement. while (firstUnclosedResult != null) @@ -532,7 +532,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement if (preparedQuery != null) { ++m_useCount; // We used this statement once more. - if ((m_prepareThreshold == 0 || m_useCount < m_prepareThreshold) && !ForceBinaryTransfers) + if ((m_prepareThreshold == 0 || m_useCount < m_prepareThreshold) && !forceBinaryTransfers) flags |= QueryExecutor.QUERY_ONESHOT; } @@ -543,7 +543,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement if (concurrency != ResultSet.CONCUR_READ_ONLY) flags |= QueryExecutor.QUERY_NO_BINARY_TRANSFER; - if (!queryToExecute.isStatementDescribed() && ForceBinaryTransfers) { + if (!queryToExecute.isStatementDescribed() && forceBinaryTransfers) { int flags2 = flags | QueryExecutor.QUERY_DESCRIBE_ONLY; StatementResultHandler handler2 = new StatementResultHandler(); connection.getQueryExecutor().execute(queryToExecute, queryParameters, handler2, 0, 0, flags2); @@ -2607,11 +2607,11 @@ public abstract class AbstractJdbc2Statement implements BaseStatement checkClosed(); if (newThreshold < 0) { - ForceBinaryTransfers = true; + forceBinaryTransfers = true; newThreshold = 1; } else - ForceBinaryTransfers = false; + forceBinaryTransfers = false; this.m_prepareThreshold = newThreshold; } @@ -2868,7 +2868,7 @@ public abstract class AbstractJdbc2Statement implements BaseStatement if (connection.getAutoCommit()) flags |= QueryExecutor.QUERY_SUPPRESS_BEGIN; - if (preDescribe || ForceBinaryTransfers) { + if (preDescribe || forceBinaryTransfers) { int flags2 = flags | QueryExecutor.QUERY_DESCRIBE_ONLY; StatementResultHandler handler2 = new StatementResultHandler(); connection.getQueryExecutor().execute(queries[0], parameterLists[0], handler2, 0, 0, flags2); diff --git a/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java b/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java index fddd10a..2c06bd0 100644 --- a/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java +++ b/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java @@ -94,7 +94,8 @@ public class ServerPreparedStmtTest extends TestCase rs.close(); //Verify that using the statement still works after turning off prepares - if (AbstractJdbc2Statement.ForceBinaryTransfers) { + + if (((AbstractJdbc2Statement)pstmt).forceBinaryTransfers) { return; } ((PGStatement)pstmt).setUseServerPrepare(false); @@ -128,7 +129,7 @@ public class ServerPreparedStmtTest extends TestCase rs.close(); //Verify that using the statement still works after turning off prepares - if (AbstractJdbc2Statement.ForceBinaryTransfers) { + if (((AbstractJdbc2Statement)pstmt).forceBinaryTransfers) { return; } -- 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

