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 7488740a4d96b8297190097f03da57ce69a4a0a5 Author: Dave Cramer <[email protected]> Date: Mon Sep 15 10:14:24 2014 +0000 Clob will now use the connection encoding pull #121 from brekka/clob_encoding --- org/postgresql/jdbc2/AbstractJdbc2Clob.java | 7 +++++-- org/postgresql/jdbc2/AbstractJdbc2Statement.java | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/org/postgresql/jdbc2/AbstractJdbc2Clob.java b/org/postgresql/jdbc2/AbstractJdbc2Clob.java index e18bcd2..f6d5f85 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Clob.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Clob.java @@ -8,13 +8,15 @@ package org.postgresql.jdbc2; -import org.postgresql.core.BaseConnection; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.charset.Charset; import java.sql.Clob; import java.sql.SQLException; +import org.postgresql.core.BaseConnection; + public abstract class AbstractJdbc2Clob extends AbstractJdbc2BlobClob { @@ -30,7 +32,8 @@ public abstract class AbstractJdbc2Clob extends AbstractJdbc2BlobClob public synchronized Reader getCharacterStream() throws SQLException { - return new InputStreamReader(getBinaryStream()); + Charset connectionCharset = Charset.forName(conn.getEncoding().name()); + return new InputStreamReader(getBinaryStream(), connectionCharset); } public synchronized String getSubString(long i, int j) throws SQLException diff --git a/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/org/postgresql/jdbc2/AbstractJdbc2Statement.java index 6c6d473..c7e6b4f 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Statement.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Statement.java @@ -12,6 +12,7 @@ import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.*; +import java.nio.charset.Charset; import java.sql.*; import java.util.ArrayList; import java.util.List; @@ -3177,12 +3178,14 @@ public abstract class AbstractJdbc2Statement implements BaseStatement return; } - InputStream l_inStream = x.getAsciiStream(); + Reader l_inStream = x.getCharacterStream(); int l_length = (int) x.length(); LargeObjectManager lom = connection.getLargeObjectAPI(); long oid = lom.createLO(); + Charset connectionCharset = Charset.forName(connection.getEncoding().name()); LargeObject lob = lom.open(oid); OutputStream los = lob.getOutputStream(); + Writer lw = new OutputStreamWriter(los, connectionCharset); try { // could be buffered, but then the OutputStream returned by LargeObject @@ -3192,11 +3195,11 @@ public abstract class AbstractJdbc2Statement implements BaseStatement int p = 0; while (c > -1 && p < l_length) { - los.write(c); + lw.write(c); c = l_inStream.read(); p++; } - los.close(); + lw.close(); } catch (IOException se) { -- 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

