Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9445f0

Browse files
committed
The following patch for JDBC fixes an issue with jdbc running on a
non-multibyte database loosing 8bit characters. This patch will causethe jdbc driver to ignore the encoding reported by the database whenmultibyte isn't enabled and use the JVM default in that case.Barry Lind
1 parentc6b1ef8 commitc9445f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎src/interfaces/jdbc/org/postgresql/Connection.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
importorg.postgresql.util.*;
1111

1212
/**
13-
* $Id: Connection.java,v 1.15 2001/05/09 21:11:26 momjian Exp $
13+
* $Id: Connection.java,v 1.16 2001/06/01 20:57:58 momjian Exp $
1414
*
1515
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
1616
* JDBC2 versions of the Connection class.
@@ -267,7 +267,8 @@ protected void openConnection(String host, int port, Properties info, String dat
267267
//
268268
firstWarning =null;
269269

270-
java.sql.ResultSetinitrset =ExecSQL("set datestyle to 'ISO'; select getdatabaseencoding()");
270+
java.sql.ResultSetinitrset =ExecSQL("set datestyle to 'ISO'; " +
271+
"select case when pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding() end");
271272

272273
StringdbEncoding =null;
273274
//retrieve DB properties
@@ -319,6 +320,11 @@ protected void openConnection(String host, int port, Properties info, String dat
319320

320321
}elseif (dbEncoding.equals("WIN")) {
321322
dbEncoding ="Cp1252";
323+
}elseif (dbEncoding.equals("UNKNOWN")) {
324+
//This isn't a multibyte database so we don't have an encoding to use
325+
//We leave dbEncoding null which will cause the default encoding for the
326+
//JVM to be used
327+
dbEncoding =null;
322328
}else {
323329
dbEncoding =null;
324330
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp