From 5517f26ab9e8a09c29f67664f1af5921c7900ce9 Mon Sep 17 00:00:00 2001 From: zephyr Date: Thu, 13 Jun 2024 09:41:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0bpcharc=E5=92=8Cvarcharc?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=8F=8A=E7=9B=B8=E5=85=B3=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pgjdbc/src/main/java/org/postgresql/core/Oid.java | 4 ++++ .../java/org/postgresql/jdbc/PgPreparedStatement.java | 8 ++++++++ pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | 2 ++ .../src/main/java/org/postgresql/jdbc/TypeInfoCache.java | 2 ++ 4 files changed, 16 insertions(+) diff --git a/pgjdbc/src/main/java/org/postgresql/core/Oid.java b/pgjdbc/src/main/java/org/postgresql/core/Oid.java index 4305022..001b21f 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/Oid.java +++ b/pgjdbc/src/main/java/org/postgresql/core/Oid.java @@ -54,10 +54,14 @@ public class Oid { public static final int BYTEA_ARRAY = 1001; public static final int VARCHAR = 1043; public static final int VARCHAR_ARRAY = 1015; + public static final int VARCHARC = 8005; + public static final int VARCHARC_ARRAY = 8073; public static final int OID = 26; public static final int OID_ARRAY = 1028; public static final int BPCHAR = 1042; public static final int BPCHAR_ARRAY = 1014; + public static final int BPCHARC = 8004; + public static final int BPCHARC_ARRAY = 8072; public static final int MONEY = 790; public static final int MONEY_ARRAY = 791; public static final int NAME = 19; diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java index e412ae3..3de637f 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java @@ -599,9 +599,17 @@ class PgPreparedStatement extends PgStatement implements PreparedStatement { case Types.CHAR: setString(parameterIndex, castToString(in), Oid.BPCHAR); break; + // todo + case Oid.BPCHARC: + setString(parameterIndex, castToString(in), Oid.BPCHARC); + break; case Types.VARCHAR: setString(parameterIndex, castToString(in), Oid.VARCHAR); break; + // todo + case Oid.VARCHARC: + setString(parameterIndex, castToString(in), Oid.VARCHARC); + break; case Types.LONGVARCHAR: if (in instanceof InputStream) { preparedParameters.setText(parameterIndex, (InputStream)in); diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java index ca5a23d..f97b6f0 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java @@ -279,6 +279,8 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS case Types.FLOAT: case Types.DOUBLE: return getDouble(columnIndex); + case Oid.BPCHARC: + case Oid.VARCHARC: case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java b/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java index af9a38c..9ebfa4a 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java @@ -86,7 +86,9 @@ public class TypeInfoCache implements TypeInfo { {"float8", Oid.FLOAT8, Types.DOUBLE, "java.lang.Double", Oid.FLOAT8_ARRAY}, {"char", Oid.CHAR, Types.CHAR, "java.lang.String", Oid.CHAR_ARRAY}, {"bpchar", Oid.BPCHAR, Types.CHAR, "java.lang.String", Oid.BPCHAR_ARRAY}, + {"bpcharc", Oid.BPCHARC, Types.CHAR, "java.lang.String", Oid.BPCHARC_ARRAY}, {"varchar", Oid.VARCHAR, Types.VARCHAR, "java.lang.String", Oid.VARCHAR_ARRAY}, + {"varcharc", Oid.VARCHARC, Types.VARCHAR, "java.lang.String", Oid.VARCHARC_ARRAY}, {"text", Oid.TEXT, Types.VARCHAR, "java.lang.String", Oid.TEXT_ARRAY}, {"name", Oid.NAME, Types.VARCHAR, "java.lang.String", Oid.NAME_ARRAY}, {"bytea", Oid.BYTEA, Types.BINARY, "[B", Oid.BYTEA_ARRAY}, -- Gitee