This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to tag REL9_3_1103 in repository libpostgresql-jdbc-java.
commit b90557ca2b0067f1b7f4a68afd0a4d25d060abbb Author: Alexis Meneses <[email protected]> Date: Thu Dec 4 21:30:36 2014 +0100 Setting the search_path from currentSchema property is done in startup packet (v3 protocol only) (cherry picked from commit 3c676cdc5bed5dbd85158628be60bb3261c6e76f) Conflicts: org/postgresql/core/v3/ConnectionFactoryImpl.java --- org/postgresql/core/v2/ConnectionFactoryImpl.java | 9 ++++++++ org/postgresql/core/v3/ConnectionFactoryImpl.java | 27 ++++++++++++++--------- org/postgresql/jdbc2/AbstractJdbc2Connection.java | 6 ----- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/org/postgresql/core/v2/ConnectionFactoryImpl.java b/org/postgresql/core/v2/ConnectionFactoryImpl.java index ed7a264..3d20112 100644 --- a/org/postgresql/core/v2/ConnectionFactoryImpl.java +++ b/org/postgresql/core/v2/ConnectionFactoryImpl.java @@ -490,5 +490,14 @@ public class ConnectionFactoryImpl extends ConnectionFactory { sb.append("'"); SetupQueryRunner.run(protoConnection, sb.toString(), false); } + + String currentSchema = info.getProperty("currentSchema"); + if (currentSchema != null) + { + StringBuffer sb = new StringBuffer("SET search_path = '"); + Utils.appendEscapedLiteral(sb, appName, protoConnection.getStandardConformingStrings()); + sb.append("'"); + SetupQueryRunner.run(protoConnection, sb.toString(), false); + } } } diff --git a/org/postgresql/core/v3/ConnectionFactoryImpl.java b/org/postgresql/core/v3/ConnectionFactoryImpl.java index dfae87a..2d17e1d 100644 --- a/org/postgresql/core/v3/ConnectionFactoryImpl.java +++ b/org/postgresql/core/v3/ConnectionFactoryImpl.java @@ -8,9 +8,10 @@ */ package org.postgresql.core.v3; +import java.util.ArrayList; +import java.util.List; import java.util.Properties; import java.util.TimeZone; - import java.sql.SQLException; import java.io.IOException; import java.net.ConnectException; @@ -165,15 +166,21 @@ public class ConnectionFactoryImpl extends ConnectionFactory { logger.info("Receive Buffer Size is " + newStream.getSocket().getReceiveBufferSize()); logger.info("Send Buffer Size is " + newStream.getSocket().getSendBufferSize()); - // Construct and send a startup packet. - String[][] params = { - { "user", user }, - { "database", database }, - { "client_encoding", "UTF8" }, - { "DateStyle", "ISO" }, - { "extra_float_digits", "2" }, - { "TimeZone", createPostgresTimeZone() }, - }; + List<String[]> paramList = new ArrayList<String[]>(); + paramList.add(new String[] {"user", user}); + paramList.add(new String[] {"database", database}); + paramList.add(new String[] {"client_encoding", "UTF8"}); + paramList.add(new String[] {"DateStyle", "ISO"}); + paramList.add(new String[] {"TimeZone", createPostgresTimeZone()}); + paramList.add(new String[] {"extra_float_digits", "2"}); + + String currentSchema = info.getProperty("currentSchema"); + if (currentSchema != null) + { + paramList.add(new String[] {"search_path", currentSchema}); + } + + String[][] params = paramList.toArray(new String[][]{}); sendStartupPacket(newStream, params, logger); diff --git a/org/postgresql/jdbc2/AbstractJdbc2Connection.java b/org/postgresql/jdbc2/AbstractJdbc2Connection.java index 31e5aba..a3190a0 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Connection.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Connection.java @@ -269,12 +269,6 @@ public abstract class AbstractJdbc2Connection implements BaseConnection } this.disableColumnSanitiser = Boolean.valueOf(info.getProperty("" + "disableColumnSanitiser", Boolean.FALSE.toString())); - - String currentSchema = info.getProperty("currentSchema"); - if (currentSchema != null) - { - setSchema(currentSchema); - } } private Set<Integer> getOidSet(String oidList) throws PSQLException { -- 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

