This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 492ba451181 Rename enum name of MySQLBinaryColumnType and
PostgreSQLComBindPacket (#25979)
492ba451181 is described below
commit 492ba45118137b3a835de3e455a606b571653034
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jun 1 12:18:40 2023 +0800
Rename enum name of MySQLBinaryColumnType and PostgreSQLComBindPacket
(#25979)
---
.../mysql/constant/MySQLBinaryColumnType.java | 104 ++++++-------
.../binlog/row/MySQLBinlogTableMapEventPacket.java | 30 ++--
.../value/MySQLBinlogProtocolValueFactory.java | 44 +++---
.../string/MySQLStringBinlogProtocolValue.java | 6 +-
.../protocol/MySQLBinaryProtocolValueFactory.java | 52 +++----
.../mysql/constant/MySQLBinaryColumnTypeTest.java | 44 +++---
.../binlog/row/MySQLBinlogRowsEventPacketTest.java | 2 +-
.../row/MySQLBinlogTableMapEventPacketTest.java | 12 +-
.../value/MySQLBinlogProtocolValueFactoryTest.java | 4 +-
.../blob/MySQLBlobBinlogProtocolValueTest.java | 2 +-
.../MySQLDecimalBinlogProtocolValueTest.java | 4 +-
.../string/MySQLJsonBinlogProtocolValueTest.java | 2 +-
.../string/MySQLStringBinlogProtocolValueTest.java | 16 +-
.../MySQLVarcharBinlogProtocolValueTest.java | 2 +-
.../MySQLDatetime2BinlogProtocolValueTest.java | 2 +-
.../time/MySQLTime2BinlogProtocolValueTest.java | 2 +-
.../MySQLTimestamp2BinlogProtocolValueTest.java | 2 +-
.../query/MySQLColumnDefinition41PacketTest.java | 4 +-
.../execute/MySQLBinaryResultSetRowPacketTest.java | 2 +-
.../execute/MySQLComStmtExecutePacketTest.java | 6 +-
.../MySQLBinaryProtocolValueFactoryTest.java | 52 +++----
.../extended/bind/OpenGaussComBatchBindPacket.java | 22 +--
.../bind/OpenGaussComBatchBindPacketTest.java | 2 +-
.../query/extended/PostgreSQLColumnType.java | 162 ++++++++++-----------
.../extended/bind/PostgreSQLComBindPacket.java | 28 ++--
.../PostgreSQLBinaryProtocolValueFactory.java | 42 +++---
.../command/query/PostgreSQLDataRowPacketTest.java | 4 +-
.../query/extended/PostgreSQLColumnTypeTest.java | 46 +++---
.../extended/bind/PostgreSQLComBindPacketTest.java | 2 +-
.../PostgreSQLBinaryProtocolValueFactoryTest.java | 22 +--
.../parse/PostgreSQLComParsePacketTest.java | 2 +-
.../mysql/ingest/binlog/BinlogContextTest.java | 2 +-
.../netty/MySQLBinlogEventPacketDecoderTest.java | 4 +-
.../prepare/MySQLComStmtPrepareExecutor.java | 6 +-
.../fieldlist/MySQLComFieldListPacketExecutor.java | 2 +-
.../describe/PostgreSQLComDescribeExecutor.java | 6 +-
.../extended/parse/PostgreSQLComParseExecutor.java | 2 +-
...egatedBatchedStatementsCommandExecutorTest.java | 4 +-
.../PostgreSQLBatchedStatementsExecutorTest.java | 2 +-
.../PostgreSQLComDescribeExecutorTest.java | 40 ++---
.../parse/PostgreSQLComParseExecutorTest.java | 4 +-
41 files changed, 399 insertions(+), 399 deletions(-)
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnType.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnType.java
index 19b42e89dfc..291277bdbce 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnType.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnType.java
@@ -35,72 +35,72 @@ import java.util.Map;
@Getter
public enum MySQLBinaryColumnType implements BinaryColumnType {
- MYSQL_TYPE_DECIMAL(0x00),
+ DECIMAL(0x00),
- MYSQL_TYPE_TINY(0x01),
+ TINY(0x01),
- MYSQL_TYPE_SHORT(0x02),
+ SHORT(0x02),
- MYSQL_TYPE_LONG(0x03),
+ LONG(0x03),
- MYSQL_TYPE_FLOAT(0x04),
+ FLOAT(0x04),
- MYSQL_TYPE_DOUBLE(0x05),
+ DOUBLE(0x05),
- MYSQL_TYPE_NULL(0x06),
+ NULL(0x06),
- MYSQL_TYPE_TIMESTAMP(0x07),
+ TIMESTAMP(0x07),
- MYSQL_TYPE_LONGLONG(0x08),
+ LONGLONG(0x08),
- MYSQL_TYPE_INT24(0x09),
+ INT24(0x09),
- MYSQL_TYPE_DATE(0x0a),
+ DATE(0x0a),
- MYSQL_TYPE_TIME(0x0b),
+ TIME(0x0b),
- MYSQL_TYPE_DATETIME(0x0c),
+ DATETIME(0x0c),
- MYSQL_TYPE_YEAR(0x0d),
+ YEAR(0x0d),
- MYSQL_TYPE_NEWDATE(0x0e),
+ NEWDATE(0x0e),
- MYSQL_TYPE_VARCHAR(0x0f),
+ VARCHAR(0x0f),
- MYSQL_TYPE_BIT(0x10),
+ BIT(0x10),
- MYSQL_TYPE_TIMESTAMP2(0x11),
+ TIMESTAMP2(0x11),
- MYSQL_TYPE_DATETIME2(0x12),
+ DATETIME2(0x12),
- MYSQL_TYPE_TIME2(0x13),
+ TIME2(0x13),
/**
* Do not describe in document, but actual exist.
*
* @see <a href="https://github.com/apache/shardingsphere/issues/4795"></a>
*/
- MYSQL_TYPE_JSON(0xf5),
+ JSON(0xf5),
- MYSQL_TYPE_NEWDECIMAL(0xf6),
+ NEWDECIMAL(0xf6),
- MYSQL_TYPE_ENUM(0xf7),
+ ENUM(0xf7),
- MYSQL_TYPE_SET(0xf8),
+ SET(0xf8),
- MYSQL_TYPE_TINY_BLOB(0xf9),
+ TINY_BLOB(0xf9),
- MYSQL_TYPE_MEDIUM_BLOB(0xfa),
+ MEDIUM_BLOB(0xfa),
- MYSQL_TYPE_LONG_BLOB(0xfb),
+ LONG_BLOB(0xfb),
- MYSQL_TYPE_BLOB(0xfc),
+ BLOB(0xfc),
- MYSQL_TYPE_VAR_STRING(0xfd),
+ VAR_STRING(0xfd),
- MYSQL_TYPE_STRING(0xfe),
+ STRING(0xfe),
- MYSQL_TYPE_GEOMETRY(0xff);
+ GEOMETRY(0xff);
private static final Map<Integer, MySQLBinaryColumnType>
JDBC_TYPE_AND_COLUMN_TYPE_MAP = new HashMap<>(values().length, 1F);
@@ -109,27 +109,27 @@ public enum MySQLBinaryColumnType implements
BinaryColumnType {
private final int value;
static {
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIT, MYSQL_TYPE_BIT);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TINYINT, MYSQL_TYPE_TINY);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SMALLINT, MYSQL_TYPE_SHORT);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.INTEGER, MYSQL_TYPE_LONG);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIGINT, MYSQL_TYPE_LONGLONG);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.FLOAT, MYSQL_TYPE_FLOAT);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.REAL, MYSQL_TYPE_FLOAT);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DOUBLE, MYSQL_TYPE_DOUBLE);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NUMERIC,
MYSQL_TYPE_NEWDECIMAL);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DECIMAL,
MYSQL_TYPE_NEWDECIMAL);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.CHAR, MYSQL_TYPE_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARCHAR,
MYSQL_TYPE_VAR_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.LONGVARCHAR,
MYSQL_TYPE_VAR_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DATE, MYSQL_TYPE_DATE);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIME, MYSQL_TYPE_TIME);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIMESTAMP,
MYSQL_TYPE_TIMESTAMP);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BINARY, MYSQL_TYPE_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARBINARY,
MYSQL_TYPE_VAR_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.LONGVARBINARY,
MYSQL_TYPE_VAR_STRING);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NULL, MYSQL_TYPE_NULL);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BLOB, MYSQL_TYPE_BLOB);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIT, BIT);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TINYINT, TINY);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SMALLINT, SHORT);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.INTEGER, LONG);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIGINT, LONGLONG);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.FLOAT, FLOAT);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.REAL, FLOAT);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DOUBLE, DOUBLE);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NUMERIC, NEWDECIMAL);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DECIMAL, NEWDECIMAL);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.CHAR, STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARCHAR, VAR_STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.LONGVARCHAR, VAR_STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DATE, DATE);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIME, TIME);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIMESTAMP, TIMESTAMP);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BINARY, STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARBINARY, VAR_STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.LONGVARBINARY, VAR_STRING);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NULL, NULL);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BLOB, BLOB);
for (MySQLBinaryColumnType each : values()) {
VALUE_AND_COLUMN_TYPE_MAP.put(each.value, each);
}
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacket.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacket.java
index f1cd8886394..018c07382a3 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacket.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacket.java
@@ -87,23 +87,23 @@ public final class MySQLBinlogTableMapEventPacket extends
AbstractMySQLBinlogEve
private int readColumnMetaDef(final MySQLBinaryColumnType columnType,
final MySQLPacketPayload payload) {
switch (columnType) {
- case MYSQL_TYPE_STRING:
- case MYSQL_TYPE_DECIMAL:
- case MYSQL_TYPE_NEWDECIMAL:
+ case STRING:
+ case DECIMAL:
+ case NEWDECIMAL:
return payload.getByteBuf().readUnsignedShort();
- case MYSQL_TYPE_BIT:
- case MYSQL_TYPE_VAR_STRING:
- case MYSQL_TYPE_VARCHAR:
- case MYSQL_TYPE_ENUM:
+ case BIT:
+ case VAR_STRING:
+ case VARCHAR:
+ case ENUM:
return payload.readInt2();
- case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_TINY_BLOB:
- case MYSQL_TYPE_DOUBLE:
- case MYSQL_TYPE_FLOAT:
- case MYSQL_TYPE_TIME2:
- case MYSQL_TYPE_TIMESTAMP2:
- case MYSQL_TYPE_DATETIME2:
- case MYSQL_TYPE_JSON:
+ case BLOB:
+ case TINY_BLOB:
+ case DOUBLE:
+ case FLOAT:
+ case TIME2:
+ case TIMESTAMP2:
+ case DATETIME2:
+ case JSON:
return payload.readInt1();
default:
return 0;
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactory.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactory.java
index 2ecb64c3082..d2c95082ee5 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactory.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactory.java
@@ -63,40 +63,40 @@ public final class MySQLBinlogProtocolValueFactory {
}
private static void registerIntegerTypeValue() {
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_BIT, new
MySQLBitBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TINY, new
MySQLTinyBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_SHORT, new
MySQLShortBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_INT24, new
MySQLInt24BinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_LONG, new
MySQLLongBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG,
new MySQLLongLongBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.BIT, new
MySQLBitBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TINY, new
MySQLTinyBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.SHORT, new
MySQLShortBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.INT24, new
MySQLInt24BinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.LONG, new
MySQLLongBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.LONGLONG, new
MySQLLongLongBinlogProtocolValue());
}
private static void registerDecimalTypeValue() {
-
BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL, new
MySQLDecimalBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DOUBLE,
new MySQLDoubleBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_FLOAT, new
MySQLFloatBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.NEWDECIMAL, new
MySQLDecimalBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DOUBLE, new
MySQLDoubleBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.FLOAT, new
MySQLFloatBinlogProtocolValue());
}
private static void registerTimeTypeValue() {
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_YEAR, new
MySQLYearBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DATE, new
MySQLDateBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIME, new
MySQLTimeBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIME2, new
MySQLTime2BinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP,
new MySQLTimestampBinlogProtocolValue());
-
BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP2, new
MySQLTimestamp2BinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME,
new MySQLDatetimeBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME2,
new MySQLDatetime2BinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.YEAR, new
MySQLYearBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DATE, new
MySQLDateBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIME, new
MySQLTimeBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIME2, new
MySQLTime2BinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIMESTAMP, new
MySQLTimestampBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIMESTAMP2, new
MySQLTimestamp2BinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DATETIME, new
MySQLDatetimeBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DATETIME2, new
MySQLDatetime2BinlogProtocolValue());
}
private static void registerStringTypeValue() {
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_STRING,
new MySQLStringBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR,
new MySQLVarcharBinlogProtocolValue());
-
BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING, new
MySQLVarcharBinlogProtocolValue());
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_JSON, new
MySQLJsonBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.STRING, new
MySQLStringBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.VARCHAR, new
MySQLVarcharBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.VAR_STRING, new
MySQLVarcharBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.JSON, new
MySQLJsonBinlogProtocolValue());
}
private static void registerBlobTypeValue() {
- BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_BLOB, new
MySQLBlobBinlogProtocolValue());
+ BINLOG_PROTOCOL_VALUES.put(MySQLBinaryColumnType.BLOB, new
MySQLBlobBinlogProtocolValue());
}
/**
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java
index 3097eb81d54..6571093d9b6 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java
@@ -40,11 +40,11 @@ public final class MySQLStringBinlogProtocolValue
implements MySQLBinlogProtocol
type |= 0x30;
}
switch (MySQLBinaryColumnType.valueOf(type)) {
- case MYSQL_TYPE_ENUM:
+ case ENUM:
return readEnumValue(length, payload);
- case MYSQL_TYPE_SET:
+ case SET:
return payload.getByteBuf().readByte();
- case MYSQL_TYPE_STRING:
+ case STRING:
return new
MySQLBinaryString(payload.readStringFixByBytes(readActualLength(length,
payload)));
default:
throw new
UnsupportedSQLOperationException(MySQLBinaryColumnType.valueOf(type).toString());
diff --git
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
index 01f52b5590e..60e6aa885ea 100644
---
a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
+++
b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
@@ -49,67 +49,67 @@ public final class MySQLBinaryProtocolValueFactory {
private static void setStringLenencBinaryProtocolValue() {
MySQLStringLenencBinaryProtocolValue binaryProtocolValue = new
MySQLStringLenencBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_STRING,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR,
binaryProtocolValue);
-
BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_ENUM,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_SET,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_LONG_BLOB,
binaryProtocolValue);
-
BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_MEDIUM_BLOB,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_BLOB,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TINY_BLOB,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_GEOMETRY,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_BIT,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL,
binaryProtocolValue);
-
BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.STRING,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.VARCHAR,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.VAR_STRING,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.ENUM,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.SET,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.LONG_BLOB,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MEDIUM_BLOB,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.BLOB,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TINY_BLOB,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.GEOMETRY,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.BIT,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DECIMAL,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.NEWDECIMAL,
binaryProtocolValue);
}
private static void setInt8BinaryProtocolValue() {
MySQLInt8BinaryProtocolValue binaryProtocolValue = new
MySQLInt8BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.LONGLONG,
binaryProtocolValue);
}
private static void setInt4BinaryProtocolValue() {
MySQLInt4BinaryProtocolValue binaryProtocolValue = new
MySQLInt4BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_LONG,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_INT24,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.LONG,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.INT24,
binaryProtocolValue);
}
private static void setInt2BinaryProtocolValue() {
MySQLInt2BinaryProtocolValue binaryProtocolValue = new
MySQLInt2BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_SHORT,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_YEAR,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.SHORT,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.YEAR,
binaryProtocolValue);
}
private static void setInt1BinaryProtocolValue() {
MySQLInt1BinaryProtocolValue binaryProtocolValue = new
MySQLInt1BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TINY,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TINY,
binaryProtocolValue);
}
private static void setDoubleBinaryProtocolValue() {
MySQLDoubleBinaryProtocolValue binaryProtocolValue = new
MySQLDoubleBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DOUBLE,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DOUBLE,
binaryProtocolValue);
}
private static void setFloatBinaryProtocolValue() {
MySQLFloatBinaryProtocolValue binaryProtocolValue = new
MySQLFloatBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_FLOAT,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.FLOAT,
binaryProtocolValue);
}
private static void setDateBinaryProtocolValue() {
MySQLDateBinaryProtocolValue binaryProtocolValue = new
MySQLDateBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DATE,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DATE,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.DATETIME,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIMESTAMP,
binaryProtocolValue);
}
private static void setTimeBinaryProtocolValue() {
MySQLTimeBinaryProtocolValue binaryProtocolValue = new
MySQLTimeBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_TIME,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.TIME,
binaryProtocolValue);
}
private static void setNullBinaryProtocolValue() {
- BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.MYSQL_TYPE_NULL,
null);
+ BINARY_PROTOCOL_VALUES.put(MySQLBinaryColumnType.NULL, null);
}
/**
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
index 197c36e7e0f..6e387c6135e 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLBinaryColumnTypeTest.java
@@ -29,27 +29,27 @@ class MySQLBinaryColumnTypeTest {
@Test
void assertValueOfJDBC() {
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BIT),
is(MySQLBinaryColumnType.MYSQL_TYPE_BIT));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TINYINT),
is(MySQLBinaryColumnType.MYSQL_TYPE_TINY));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.SMALLINT),
is(MySQLBinaryColumnType.MYSQL_TYPE_SHORT));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.INTEGER),
is(MySQLBinaryColumnType.MYSQL_TYPE_LONG));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BIGINT),
is(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.FLOAT),
is(MySQLBinaryColumnType.MYSQL_TYPE_FLOAT));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.REAL),
is(MySQLBinaryColumnType.MYSQL_TYPE_FLOAT));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DOUBLE),
is(MySQLBinaryColumnType.MYSQL_TYPE_DOUBLE));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.NUMERIC),
is(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DECIMAL),
is(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.CHAR),
is(MySQLBinaryColumnType.MYSQL_TYPE_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.VARCHAR),
is(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.LONGVARCHAR),
is(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DATE),
is(MySQLBinaryColumnType.MYSQL_TYPE_DATE));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TIME),
is(MySQLBinaryColumnType.MYSQL_TYPE_TIME));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TIMESTAMP),
is(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BINARY),
is(MySQLBinaryColumnType.MYSQL_TYPE_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.VARBINARY),
is(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.LONGVARBINARY),
is(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.NULL),
is(MySQLBinaryColumnType.MYSQL_TYPE_NULL));
- assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BLOB),
is(MySQLBinaryColumnType.MYSQL_TYPE_BLOB));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BIT),
is(MySQLBinaryColumnType.BIT));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TINYINT),
is(MySQLBinaryColumnType.TINY));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.SMALLINT),
is(MySQLBinaryColumnType.SHORT));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.INTEGER),
is(MySQLBinaryColumnType.LONG));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BIGINT),
is(MySQLBinaryColumnType.LONGLONG));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.FLOAT),
is(MySQLBinaryColumnType.FLOAT));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.REAL),
is(MySQLBinaryColumnType.FLOAT));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DOUBLE),
is(MySQLBinaryColumnType.DOUBLE));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.NUMERIC),
is(MySQLBinaryColumnType.NEWDECIMAL));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DECIMAL),
is(MySQLBinaryColumnType.NEWDECIMAL));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.CHAR),
is(MySQLBinaryColumnType.STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.VARCHAR),
is(MySQLBinaryColumnType.VAR_STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.LONGVARCHAR),
is(MySQLBinaryColumnType.VAR_STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.DATE),
is(MySQLBinaryColumnType.DATE));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TIME),
is(MySQLBinaryColumnType.TIME));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.TIMESTAMP),
is(MySQLBinaryColumnType.TIMESTAMP));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BINARY),
is(MySQLBinaryColumnType.STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.VARBINARY),
is(MySQLBinaryColumnType.VAR_STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.LONGVARBINARY),
is(MySQLBinaryColumnType.VAR_STRING));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.NULL),
is(MySQLBinaryColumnType.NULL));
+ assertThat(MySQLBinaryColumnType.valueOfJDBCType(Types.BLOB),
is(MySQLBinaryColumnType.BLOB));
}
@Test
@@ -59,7 +59,7 @@ class MySQLBinaryColumnTypeTest {
@Test
void assertValueOf() {
-
assertThat(MySQLBinaryColumnType.valueOf(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL.getValue()),
is(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL));
+
assertThat(MySQLBinaryColumnType.valueOf(MySQLBinaryColumnType.DECIMAL.getValue()),
is(MySQLBinaryColumnType.DECIMAL));
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
index 3d4950f0772..597f5161888 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogRowsEventPacketTest.java
@@ -67,7 +67,7 @@ class MySQLBinlogRowsEventPacketTest {
private void mockColumnDefs() {
columnDefs = new ArrayList<>();
- columnDefs.add(new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG));
+ columnDefs.add(new
MySQLBinlogColumnDef(MySQLBinaryColumnType.LONGLONG));
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
index f7acd41c1b1..3a8b5724bc4 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/MySQLBinlogTableMapEventPacketTest.java
@@ -54,8 +54,8 @@ class MySQLBinlogTableMapEventPacketTest {
void assertNew() {
when(payload.readInt6()).thenReturn(1L);
when(payload.readInt2()).thenReturn(0, 255);
- when(payload.readInt1()).thenReturn(4, 4,
MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG.getValue(),
MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR.getValue(),
- MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL.getValue(),
MySQLBinaryColumnType.MYSQL_TYPE_DATETIME2.getValue(), 11,
+ when(payload.readInt1()).thenReturn(4, 4,
MySQLBinaryColumnType.LONGLONG.getValue(),
MySQLBinaryColumnType.VARCHAR.getValue(),
+ MySQLBinaryColumnType.NEWDECIMAL.getValue(),
MySQLBinaryColumnType.DATETIME2.getValue(), 11,
0x0e);
when(payload.readStringFix(4)).thenReturn("test");
when(payload.readIntLenenc()).thenReturn(4L);
@@ -76,10 +76,10 @@ class MySQLBinlogTableMapEventPacketTest {
private void assertColumnDefs(final Collection<MySQLBinlogColumnDef>
columnDefs) {
assertThat(columnDefs.size(), is(4));
Iterator<MySQLBinlogColumnDef> columnDefIterator =
columnDefs.iterator();
- assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG, 0);
- assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR, 255);
- assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL, 10);
- assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.MYSQL_TYPE_DATETIME2, 11);
+ assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.LONGLONG, 0);
+ assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.VARCHAR, 255);
+ assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.NEWDECIMAL, 10);
+ assertColumnDef(columnDefIterator.next(),
MySQLBinaryColumnType.DATETIME2, 11);
}
private void assertColumnDef(final MySQLBinlogColumnDef actual, final
MySQLBinaryColumnType columnType, final int columnMeta) {
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
index d194e82ad8f..c423fe8af30 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/MySQLBinlogProtocolValueFactoryTest.java
@@ -29,11 +29,11 @@ class MySQLBinlogProtocolValueFactoryTest {
@Test
void assertGetBinlogProtocolValue() {
-
assertThat(MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TINY),
instanceOf(MySQLTinyBinlogProtocolValue.class));
+
assertThat(MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.TINY),
instanceOf(MySQLTinyBinlogProtocolValue.class));
}
@Test
void assertGetBinlogProtocolValueFailure() {
- assertThrows(IllegalArgumentException.class, () ->
MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_GEOMETRY));
+ assertThrows(IllegalArgumentException.class, () ->
MySQLBinlogProtocolValueFactory.getBinlogProtocolValue(MySQLBinaryColumnType.GEOMETRY));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
index 2f47d816df9..472e0fc46d2 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/blob/MySQLBlobBinlogProtocolValueTest.java
@@ -46,7 +46,7 @@ class MySQLBlobBinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_STRING);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.STRING);
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
index 40b9f3b6ca8..5fec2b88d4a 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDecimalBinlogProtocolValueTest.java
@@ -43,7 +43,7 @@ class MySQLDecimalBinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.NEWDECIMAL);
columnDef.setColumnMeta((14 << 8) + 4);
}
@@ -65,7 +65,7 @@ class MySQLDecimalBinlogProtocolValueTest {
@Test
void assertDecodeNegativeNewDecimalWithLargeNumber() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.NEWDECIMAL);
columnDef.setColumnMeta(32 << 8 | 6);
byte[] newDecimalBytes =
ByteBufUtil.decodeHexDump("7DFEFDB5CC2741EFDEBE4154FD52E7");
when(payload.readStringFixByBytes(newDecimalBytes.length)).thenReturn(newDecimalBytes);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
index 4672a44c7f5..6a85a43a5f6 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValueTest.java
@@ -57,7 +57,7 @@ class MySQLJsonBinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_JSON);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.JSON);
when(payload.getByteBuf()).thenReturn(byteBuf);
mockJsonValue();
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
index 9b9f8c8df80..5078ee14009 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValueTest.java
@@ -49,32 +49,32 @@ class MySQLStringBinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_STRING);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.STRING);
}
@Test
void assertReadEnumValueWithMeta1() {
-
columnDef.setColumnMeta((MySQLBinaryColumnType.MYSQL_TYPE_ENUM.getValue() << 8)
+ 1);
+ columnDef.setColumnMeta((MySQLBinaryColumnType.ENUM.getValue() << 8) +
1);
when(payload.readInt1()).thenReturn(1);
assertThat(new MySQLStringBinlogProtocolValue().read(columnDef,
payload), is(1));
}
@Test
void assertReadEnumValueWithMeta2() {
-
columnDef.setColumnMeta((MySQLBinaryColumnType.MYSQL_TYPE_ENUM.getValue() << 8)
+ 2);
+ columnDef.setColumnMeta((MySQLBinaryColumnType.ENUM.getValue() << 8) +
2);
when(payload.readInt2()).thenReturn(32767);
assertThat(new MySQLStringBinlogProtocolValue().read(columnDef,
payload), is(32767));
}
@Test
void assertReadEnumValueWithMetaFailure() {
-
columnDef.setColumnMeta((MySQLBinaryColumnType.MYSQL_TYPE_ENUM.getValue() << 8)
+ 3);
+ columnDef.setColumnMeta((MySQLBinaryColumnType.ENUM.getValue() << 8) +
3);
assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLStringBinlogProtocolValue().read(columnDef, payload));
}
@Test
void assertReadSetValue() {
-
columnDef.setColumnMeta(MySQLBinaryColumnType.MYSQL_TYPE_SET.getValue() << 8);
+ columnDef.setColumnMeta(MySQLBinaryColumnType.SET.getValue() << 8);
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readByte()).thenReturn((byte) 0xff);
assertThat(new MySQLStringBinlogProtocolValue().read(columnDef,
payload), is((byte) 0xff));
@@ -83,7 +83,7 @@ class MySQLStringBinlogProtocolValueTest {
@Test
void assertReadStringValue() {
String expected = "test_value";
-
columnDef.setColumnMeta(MySQLBinaryColumnType.MYSQL_TYPE_STRING.getValue() <<
8);
+ columnDef.setColumnMeta(MySQLBinaryColumnType.STRING.getValue() << 8);
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedByte()).thenReturn((short) expected.length());
when(payload.readStringFixByBytes(expected.length())).thenReturn(expected.getBytes());
@@ -95,7 +95,7 @@ class MySQLStringBinlogProtocolValueTest {
@Test
void assertReadLongStringValue() {
String expected = "test_value";
-
columnDef.setColumnMeta((MySQLBinaryColumnType.MYSQL_TYPE_STRING.getValue() ^
((256 & 0x300) >> 4)) << 8);
+ columnDef.setColumnMeta((MySQLBinaryColumnType.STRING.getValue() ^
((256 & 0x300) >> 4)) << 8);
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedShortLE()).thenReturn(expected.length());
when(payload.readStringFixByBytes(expected.length())).thenReturn(expected.getBytes());
@@ -106,7 +106,7 @@ class MySQLStringBinlogProtocolValueTest {
@Test
void assertReadValueWithUnknownType() {
-
columnDef.setColumnMeta(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING.getValue()
<< 8);
+ columnDef.setColumnMeta(MySQLBinaryColumnType.VAR_STRING.getValue() <<
8);
assertThrows(UnsupportedSQLOperationException.class, () -> new
MySQLStringBinlogProtocolValue().read(columnDef, payload));
}
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
index e9388fa1588..0332db86592 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLVarcharBinlogProtocolValueTest.java
@@ -47,7 +47,7 @@ class MySQLVarcharBinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.VARCHAR);
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
index c92d0b15b1f..7b91c6ebec9 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
@@ -47,7 +47,7 @@ class MySQLDatetime2BinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME2);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.DATETIME2);
}
@Test
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
index 5be56de9753..0007ce09048 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
@@ -46,7 +46,7 @@ class MySQLTime2BinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_TIME2);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.TIME2);
columnDef.setColumnMeta(0);
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
index 217eef8bdd1..822dea07cd3 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
@@ -46,7 +46,7 @@ class MySQLTimestamp2BinlogProtocolValueTest {
@BeforeEach
void setUp() {
- columnDef = new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP2);
+ columnDef = new MySQLBinlogColumnDef(MySQLBinaryColumnType.TIMESTAMP2);
when(payload.getByteBuf()).thenReturn(byteBuf);
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
index 46e2f0456cd..853a95d5223 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
@@ -37,7 +37,7 @@ class MySQLColumnDefinition41PacketTest {
@Test
void assertWriteWithPayload() {
-
when(payload.readInt1()).thenReturn(MySQLBinaryColumnType.MYSQL_TYPE_LONG.getValue(),
0);
+
when(payload.readInt1()).thenReturn(MySQLBinaryColumnType.LONG.getValue(), 0);
when(payload.readInt2()).thenReturn(MySQLConstants.DEFAULT_CHARSET.getId(), 0);
when(payload.readInt4()).thenReturn(10);
when(payload.readIntLenenc()).thenReturn(0x0cL);
@@ -55,7 +55,7 @@ class MySQLColumnDefinition41PacketTest {
verify(payload).writeIntLenenc(0x0c);
verify(payload).writeInt2(MySQLConstants.DEFAULT_CHARSET.getId());
verify(payload).writeInt4(10);
-
verify(payload).writeInt1(MySQLBinaryColumnType.MYSQL_TYPE_LONG.getValue());
+ verify(payload).writeInt1(MySQLBinaryColumnType.LONG.getValue());
verify(payload).writeInt2(0);
verify(payload).writeInt1(0);
verify(payload).writeReserved(2);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
index a472105446a..cf6ff39819e 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLBinaryResultSetRowPacketTest.java
@@ -38,7 +38,7 @@ class MySQLBinaryResultSetRowPacketTest {
@Test
void assertWrite() {
- BinaryRow row = new BinaryRow(Arrays.asList(new
BinaryCell(MySQLBinaryColumnType.MYSQL_TYPE_STRING, "value"), new
BinaryCell(MySQLBinaryColumnType.MYSQL_TYPE_STRING, null)));
+ BinaryRow row = new BinaryRow(Arrays.asList(new
BinaryCell(MySQLBinaryColumnType.STRING, "value"), new
BinaryCell(MySQLBinaryColumnType.STRING, null)));
MySQLBinaryResultSetRowPacket actual = new
MySQLBinaryResultSetRowPacket(row);
actual.write(payload);
verify(payload).writeInt1(0x00);
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
index c014985c4fe..2a2a696e1a5 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
@@ -55,7 +55,7 @@ class MySQLComStmtExecutePacketTest {
assertThat(actual.getNewParametersBoundFlag(),
is(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST));
List<MySQLPreparedStatementParameterType> parameterTypes =
actual.getNewParameterTypes();
assertThat(parameterTypes.size(), is(1));
- assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.MYSQL_TYPE_LONG));
+ assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.LONG));
assertThat(parameterTypes.get(0).getUnsignedFlag(), is(0));
assertThat(actual.readParameters(parameterTypes,
Collections.emptySet(), Collections.singletonList(0)),
is(Collections.<Object>singletonList(1)));
}
@@ -69,7 +69,7 @@ class MySQLComStmtExecutePacketTest {
assertThat(actual.getNewParametersBoundFlag(),
is(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST));
List<MySQLPreparedStatementParameterType> parameterTypes =
actual.getNewParameterTypes();
assertThat(parameterTypes.size(), is(1));
- assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.MYSQL_TYPE_LONG));
+ assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.LONG));
assertThat(parameterTypes.get(0).getUnsignedFlag(), is(0));
assertThat(actual.readParameters(parameterTypes,
Collections.emptySet(), Collections.emptyList()),
is(Collections.singletonList(null)));
}
@@ -83,7 +83,7 @@ class MySQLComStmtExecutePacketTest {
assertThat(actual.getNewParametersBoundFlag(),
is(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST));
List<MySQLPreparedStatementParameterType> parameterTypes =
actual.getNewParameterTypes();
assertThat(parameterTypes.size(), is(1));
- assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.MYSQL_TYPE_BLOB));
+ assertThat(parameterTypes.get(0).getColumnType(),
is(MySQLBinaryColumnType.BLOB));
assertThat(parameterTypes.get(0).getUnsignedFlag(), is(0));
assertThat(actual.readParameters(parameterTypes,
Collections.singleton(0), Collections.emptyList()),
is(Collections.singletonList(null)));
}
diff --git
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactoryTest.java
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactoryTest.java
index 777ddf83496..fb4801aa44e 100644
---
a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactoryTest.java
+++
b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactoryTest.java
@@ -29,132 +29,132 @@ class MySQLBinaryProtocolValueFactoryTest {
@Test
void assertGetBinaryProtocolValueWithMySQLTypeString() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_STRING),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.STRING),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeVarchar() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.VARCHAR),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeVarString() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.VAR_STRING),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeEnum() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_ENUM),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.ENUM),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeSet() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_SET),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.SET),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeLongBlob() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_LONG_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.LONG_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeMediumBlob() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_MEDIUM_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MEDIUM_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeBlob() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeTinyBlob() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TINY_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.TINY_BLOB),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeGeometry() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_GEOMETRY),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.GEOMETRY),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeBit() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_BIT),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.BIT),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeDecimal() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_DECIMAL),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.DECIMAL),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeNewDecimal() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.NEWDECIMAL),
instanceOf(MySQLStringLenencBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeLongLong() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG),
instanceOf(MySQLInt8BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.LONGLONG),
instanceOf(MySQLInt8BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeLong() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_LONG),
instanceOf(MySQLInt4BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.LONG),
instanceOf(MySQLInt4BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeInt24() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_INT24),
instanceOf(MySQLInt4BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.INT24),
instanceOf(MySQLInt4BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeShort() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_SHORT),
instanceOf(MySQLInt2BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.SHORT),
instanceOf(MySQLInt2BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeYear() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_YEAR),
instanceOf(MySQLInt2BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.YEAR),
instanceOf(MySQLInt2BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeTiny() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TINY),
instanceOf(MySQLInt1BinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.TINY),
instanceOf(MySQLInt1BinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeDouble() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_DOUBLE),
instanceOf(MySQLDoubleBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.DOUBLE),
instanceOf(MySQLDoubleBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeFloat() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_FLOAT),
instanceOf(MySQLFloatBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.FLOAT),
instanceOf(MySQLFloatBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeDate() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_DATE),
instanceOf(MySQLDateBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.DATE),
instanceOf(MySQLDateBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeDatetime() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_DATETIME),
instanceOf(MySQLDateBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.DATETIME),
instanceOf(MySQLDateBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeTimestamp() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TIMESTAMP),
instanceOf(MySQLDateBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.TIMESTAMP),
instanceOf(MySQLDateBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeTime() {
-
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_TIME),
instanceOf(MySQLTimeBinaryProtocolValue.class));
+
assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.TIME),
instanceOf(MySQLTimeBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueWithMySQLTypeNull() {
-
assertNull(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.MYSQL_TYPE_NULL));
+
assertNull(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLBinaryColumnType.NULL));
}
@Test
diff --git
a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacket.java
b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacket.java
index b48a05a113e..3352c18d789 100644
---
a/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacket.java
+++
b/db-protocol/opengauss/src/main/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacket.java
@@ -113,18 +113,18 @@ public final class OpenGaussComBatchBindPacket extends
OpenGaussCommandPacket {
private Object getTextParameters(final String textValue, final
PostgreSQLColumnType columnType) {
switch (columnType) {
- case POSTGRESQL_TYPE_BOOL:
+ case BOOL:
return Boolean.valueOf(textValue);
- case POSTGRESQL_TYPE_INT2:
- case POSTGRESQL_TYPE_INT4:
+ case INT2:
+ case INT4:
return Integer.parseInt(textValue);
- case POSTGRESQL_TYPE_INT8:
+ case INT8:
return Long.parseLong(textValue);
- case POSTGRESQL_TYPE_FLOAT4:
+ case FLOAT4:
return Float.parseFloat(textValue);
- case POSTGRESQL_TYPE_FLOAT8:
+ case FLOAT8:
return Double.parseDouble(textValue);
- case POSTGRESQL_TYPE_NUMERIC:
+ case NUMERIC:
try {
return Integer.parseInt(textValue);
} catch (final NumberFormatException ignored) {
@@ -134,12 +134,12 @@ public final class OpenGaussComBatchBindPacket extends
OpenGaussCommandPacket {
} catch (final NumberFormatException ignored) {
}
return new BigDecimal(textValue);
- case POSTGRESQL_TYPE_DATE:
+ case DATE:
return Date.valueOf(textValue);
- case POSTGRESQL_TYPE_TIME:
+ case TIME:
return PostgreSQLTextTimeUtils.parse(textValue);
- case POSTGRESQL_TYPE_TIMESTAMP:
- case POSTGRESQL_TYPE_TIMESTAMPTZ:
+ case TIMESTAMP:
+ case TIMESTAMPTZ:
return PostgreSQLTextTimestampUtils.parse(textValue);
default:
return textValue;
diff --git
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
index 27911743d1a..7009c7558a7 100644
---
a/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
+++
b/db-protocol/opengauss/src/test/java/org/apache/shardingsphere/db/protocol/opengauss/packet/command/query/extended/bind/OpenGaussComBatchBindPacketTest.java
@@ -56,7 +56,7 @@ class OpenGaussComBatchBindPacketTest {
assertThat(actual.getParameterFormats(), is(Arrays.asList(0, 0, 0)));
assertTrue(actual.getResultFormats().isEmpty());
List<List<Object>> actualParameterSets = actual.readParameterSets(
- Arrays.asList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4,
PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR,
PostgreSQLColumnType.POSTGRESQL_TYPE_INT4));
+ Arrays.asList(PostgreSQLColumnType.INT4,
PostgreSQLColumnType.VARCHAR, PostgreSQLColumnType.INT4));
assertThat(actualParameterSets.size(), is(3));
List<List<Object>> expectedParameterSets =
Arrays.asList(Arrays.asList(1, "Foo", 18), Arrays.asList(2, "Bar", 36),
Arrays.asList(3, "Tom", 54));
assertThat(actualParameterSets, is(expectedParameterSets));
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
index 42977acd798..47d97c1d6e5 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
@@ -34,151 +34,151 @@ import java.util.Map;
@Getter
public enum PostgreSQLColumnType implements BinaryColumnType {
- POSTGRESQL_TYPE_UNSPECIFIED(0),
+ UNSPECIFIED(0),
- POSTGRESQL_TYPE_INT2(21),
+ INT2(21),
- POSTGRESQL_TYPE_INT2_ARRAY(1005),
+ INT2_ARRAY(1005),
- POSTGRESQL_TYPE_INT4(23),
+ INT4(23),
- POSTGRESQL_TYPE_INT4_ARRAY(1007),
+ INT4_ARRAY(1007),
- POSTGRESQL_TYPE_INT8(20),
+ INT8(20),
- POSTGRESQL_TYPE_INT8_ARRAY(1016),
+ INT8_ARRAY(1016),
- POSTGRESQL_TYPE_TEXT(25),
+ TEXT(25),
- POSTGRESQL_TYPE_TEXT_ARRAY(1009),
+ TEXT_ARRAY(1009),
- POSTGRESQL_TYPE_NUMERIC(1700),
+ NUMERIC(1700),
- POSTGRESQL_TYPE_NUMERIC_ARRAY(1231),
+ NUMERIC_ARRAY(1231),
- POSTGRESQL_TYPE_FLOAT4(700),
+ FLOAT4(700),
- POSTGRESQL_TYPE_FLOAT4_ARRAY(1021),
+ FLOAT4_ARRAY(1021),
- POSTGRESQL_TYPE_FLOAT8(701),
+ FLOAT8(701),
- POSTGRESQL_TYPE_FLOAT8_ARRAY(1022),
+ FLOAT8_ARRAY(1022),
- POSTGRESQL_TYPE_BOOL(16),
+ BOOL(16),
- POSTGRESQL_TYPE_BOOL_ARRAY(1000),
+ BOOL_ARRAY(1000),
- POSTGRESQL_TYPE_DATE(1082),
+ DATE(1082),
- POSTGRESQL_TYPE_DATE_ARRAY(1182),
+ DATE_ARRAY(1182),
- POSTGRESQL_TYPE_TIME(1083),
+ TIME(1083),
- POSTGRESQL_TYPE_TIME_ARRAY(1183),
+ TIME_ARRAY(1183),
- POSTGRESQL_TYPE_TIMETZ(1266),
+ TIMETZ(1266),
- POSTGRESQL_TYPE_TIMETZ_ARRAY(1270),
+ TIMETZ_ARRAY(1270),
- POSTGRESQL_TYPE_TIMESTAMP(1114),
+ TIMESTAMP(1114),
- POSTGRESQL_TYPE_TIMESTAMP_ARRAY(1115),
+ TIMESTAMP_ARRAY(1115),
- POSTGRESQL_TYPE_TIMESTAMPTZ(1184),
+ TIMESTAMPTZ(1184),
- POSTGRESQL_TYPE_TIMESTAMPTZ_ARRAY(1185),
+ TIMESTAMPTZ_ARRAY(1185),
- POSTGRESQL_TYPE_BYTEA(17),
+ BYTEA(17),
- POSTGRESQL_TYPE_BYTEA_ARRAY(1001),
+ BYTEA_ARRAY(1001),
- POSTGRESQL_TYPE_VARCHAR(1043),
+ VARCHAR(1043),
- POSTGRESQL_TYPE_VARCHAR_ARRAY(1015),
+ VARCHAR_ARRAY(1015),
- POSTGRESQL_TYPE_OID(26),
+ OID(26),
- POSTGRESQL_TYPE_OID_ARRAY(1028),
+ OID_ARRAY(1028),
- POSTGRESQL_TYPE_BPCHAR(1042),
+ BPCHAR(1042),
- POSTGRESQL_TYPE_BPCHAR_ARRAY(1014),
+ BPCHAR_ARRAY(1014),
- POSTGRESQL_TYPE_MONEY(790),
+ MONEY(790),
- POSTGRESQL_TYPE_MONEY_ARRAY(791),
+ MONEY_ARRAY(791),
- POSTGRESQL_TYPE_NAME(19),
+ NAME(19),
- POSTGRESQL_TYPE_NAME_ARRAY(1003),
+ NAME_ARRAY(1003),
- POSTGRESQL_TYPE_BIT(1560),
+ BIT(1560),
- POSTGRESQL_TYPE_BIT_ARRAY(1561),
+ BIT_ARRAY(1561),
- POSTGRESQL_TYPE_VOID(2278),
+ VOID(2278),
- POSTGRESQL_TYPE_INTERVAL(1186),
+ INTERVAL(1186),
- POSTGRESQL_TYPE_INTERVAL_ARRAY(1187),
+ INTERVAL_ARRAY(1187),
- POSTGRESQL_TYPE_CHAR(18),
+ CHAR(18),
- POSTGRESQL_TYPE_CHAR_ARRAY(1002),
+ CHAR_ARRAY(1002),
- POSTGRESQL_TYPE_VARBIT(1562),
+ VARBIT(1562),
- POSTGRESQL_TYPE_VARBIT_ARRAY(1563),
+ VARBIT_ARRAY(1563),
- POSTGRESQL_TYPE_UUID(2950),
+ UUID(2950),
- POSTGRESQL_TYPE_UUID_ARRAY(2951),
+ UUID_ARRAY(2951),
- POSTGRESQL_TYPE_XML(142),
+ XML(142),
- POSTGRESQL_TYPE_XML_ARRAY(143),
+ XML_ARRAY(143),
- POSTGRESQL_TYPE_POINT(600),
+ POINT(600),
- POSTGRESQL_TYPE_POINT_ARRAY(1017),
+ POINT_ARRAY(1017),
- POSTGRESQL_TYPE_BOX(603),
+ BOX(603),
- POSTGRESQL_TYPE_JSONB_ARRAY(3807),
+ JSONB_ARRAY(3807),
- POSTGRESQL_TYPE_JSON(114),
+ JSON(114),
- POSTGRESQL_TYPE_JSON_ARRAY(199),
+ JSON_ARRAY(199),
- POSTGRESQL_TYPE_REF_CURSOR(1790),
+ REF_CURSOR(1790),
- POSTGRESQL_TYPE_REF_CURSOR_ARRAY(2201);
+ REF_CURSOR_ARRAY(2201);
private static final Map<Integer, PostgreSQLColumnType>
JDBC_TYPE_AND_COLUMN_TYPE_MAP = new HashMap<>(values().length, 1F);
private final int value;
static {
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TINYINT, POSTGRESQL_TYPE_INT2);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SMALLINT,
POSTGRESQL_TYPE_INT2);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.INTEGER, POSTGRESQL_TYPE_INT4);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIGINT, POSTGRESQL_TYPE_INT8);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NUMERIC,
POSTGRESQL_TYPE_NUMERIC);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DECIMAL,
POSTGRESQL_TYPE_NUMERIC);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.REAL, POSTGRESQL_TYPE_FLOAT4);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DOUBLE,
POSTGRESQL_TYPE_FLOAT8);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.CHAR, POSTGRESQL_TYPE_CHAR);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARCHAR,
POSTGRESQL_TYPE_VARCHAR);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BINARY, POSTGRESQL_TYPE_BYTEA);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIT, POSTGRESQL_TYPE_BIT);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DATE, POSTGRESQL_TYPE_DATE);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIME, POSTGRESQL_TYPE_TIME);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIMESTAMP,
POSTGRESQL_TYPE_TIMESTAMP);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.OTHER, POSTGRESQL_TYPE_JSON);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SQLXML, POSTGRESQL_TYPE_XML);
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BOOLEAN, POSTGRESQL_TYPE_BOOL);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TINYINT, INT2);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SMALLINT, INT2);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.INTEGER, INT4);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIGINT, INT8);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.NUMERIC, NUMERIC);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DECIMAL, NUMERIC);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.REAL, FLOAT4);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DOUBLE, FLOAT8);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.CHAR, CHAR);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.VARCHAR, VARCHAR);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BINARY, BYTEA);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BIT, BIT);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.DATE, DATE);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIME, TIME);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.TIMESTAMP, TIMESTAMP);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.OTHER, JSON);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.SQLXML, XML);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.BOOLEAN, BOOL);
// TODO Temporary solution for
https://github.com/apache/shardingsphere/issues/22522
- JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.STRUCT,
POSTGRESQL_TYPE_VARCHAR);
+ JDBC_TYPE_AND_COLUMN_TYPE_MAP.put(Types.STRUCT, VARCHAR);
}
/**
@@ -201,10 +201,10 @@ public enum PostgreSQLColumnType implements
BinaryColumnType {
*/
public static PostgreSQLColumnType valueOfJDBCType(final int jdbcType,
final String columnTypeName) {
if (isPgBit(jdbcType, columnTypeName)) {
- return POSTGRESQL_TYPE_BIT;
+ return BIT;
}
if (isPgBool(jdbcType, columnTypeName)) {
- return POSTGRESQL_TYPE_BOOL;
+ return BOOL;
}
return valueOfJDBCType(jdbcType);
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacket.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacket.java
index 050ffe71b86..b2f37d52a14 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacket.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacket.java
@@ -101,20 +101,20 @@ public final class PostgreSQLComBindPacket extends
PostgreSQLCommandPacket {
private Object getTextParameters(final String textValue, final
PostgreSQLColumnType paramType) {
switch (paramType) {
- case POSTGRESQL_TYPE_UNSPECIFIED:
+ case UNSPECIFIED:
return new PostgreSQLTypeUnspecifiedSQLParameter(textValue);
- case POSTGRESQL_TYPE_BOOL:
+ case BOOL:
return Boolean.valueOf(textValue);
- case POSTGRESQL_TYPE_INT2:
- case POSTGRESQL_TYPE_INT4:
+ case INT2:
+ case INT4:
return Integer.parseInt(textValue);
- case POSTGRESQL_TYPE_INT8:
+ case INT8:
return Long.parseLong(textValue);
- case POSTGRESQL_TYPE_FLOAT4:
+ case FLOAT4:
return Float.parseFloat(textValue);
- case POSTGRESQL_TYPE_FLOAT8:
+ case FLOAT8:
return Double.parseDouble(textValue);
- case POSTGRESQL_TYPE_NUMERIC:
+ case NUMERIC:
try {
return Integer.parseInt(textValue);
} catch (final NumberFormatException ignored) {
@@ -124,16 +124,16 @@ public final class PostgreSQLComBindPacket extends
PostgreSQLCommandPacket {
} catch (final NumberFormatException ignored) {
}
return new BigDecimal(textValue);
- case POSTGRESQL_TYPE_DATE:
+ case DATE:
return Date.valueOf(textValue);
- case POSTGRESQL_TYPE_TIME:
+ case TIME:
return PostgreSQLTextTimeUtils.parse(textValue);
- case POSTGRESQL_TYPE_TIMESTAMP:
- case POSTGRESQL_TYPE_TIMESTAMPTZ:
+ case TIMESTAMP:
+ case TIMESTAMPTZ:
return PostgreSQLTextTimestampUtils.parse(textValue);
- case POSTGRESQL_TYPE_JSON:
+ case JSON:
return PostgreSQLTextJsonUtils.parse(textValue);
- case POSTGRESQL_TYPE_BIT:
+ case BIT:
return PostgreSQLTextBitUtils.parse(textValue);
default:
return textValue;
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
index e4446b5d66c..e1bf538223d 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
@@ -57,87 +57,87 @@ public final class PostgreSQLBinaryProtocolValueFactory {
private static void setUnspecifiedBinaryProtocolValue() {
PostgreSQLUnspecifiedBinaryProtocolValue binaryProtocolValue = new
PostgreSQLUnspecifiedBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.UNSPECIFIED,
binaryProtocolValue);
}
private static void setStringLenencBinaryProtocolValue() {
PostgreSQLStringBinaryProtocolValue binaryProtocolValue = new
PostgreSQLStringBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR,
binaryProtocolValue);
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.VARCHAR,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.CHAR,
binaryProtocolValue);
}
private static void setInt8BinaryProtocolValue() {
PostgreSQLInt8BinaryProtocolValue binaryProtocolValue = new
PostgreSQLInt8BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT8,
binaryProtocolValue);
}
private static void setInt4BinaryProtocolValue() {
PostgreSQLInt4BinaryProtocolValue binaryProtocolValue = new
PostgreSQLInt4BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT4,
binaryProtocolValue);
}
private static void setInt2BinaryProtocolValue() {
PostgreSQLInt2BinaryProtocolValue binaryProtocolValue = new
PostgreSQLInt2BinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT2,
binaryProtocolValue);
}
private static void setDoubleBinaryProtocolValue() {
PostgreSQLDoubleBinaryProtocolValue binaryProtocolValue = new
PostgreSQLDoubleBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT8,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.FLOAT8,
binaryProtocolValue);
}
private static void setFloatBinaryProtocolValue() {
PostgreSQLFloatBinaryProtocolValue binaryProtocolValue = new
PostgreSQLFloatBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT4,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.FLOAT4,
binaryProtocolValue);
}
private static void setNumericBinaryProtocolValue() {
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_NUMERIC,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.NUMERIC,
binaryProtocolValue);
}
private static void setDateBinaryProtocolValue() {
PostgreSQLDateBinaryProtocolValue binaryProtocolValue = new
PostgreSQLDateBinaryProtocolValue();
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_DATE,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.DATE,
binaryProtocolValue);
}
private static void setTimeBinaryProtocolValue() {
PostgreSQLTimeBinaryProtocolValue binaryProtocolValue = new
PostgreSQLTimeBinaryProtocolValue();
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_TIMESTAMP,
binaryProtocolValue);
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.TIMESTAMP,
binaryProtocolValue);
}
private static void setInt2ArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2_ARRAY, new
PostgreSQLInt2ArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT2_ARRAY, new
PostgreSQLInt2ArrayBinaryProtocolValue());
}
private static void setInt4ArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4_ARRAY, new
PostgreSQLInt4ArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT4_ARRAY, new
PostgreSQLInt4ArrayBinaryProtocolValue());
}
private static void setInt8ArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8_ARRAY, new
PostgreSQLInt8ArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.INT8_ARRAY, new
PostgreSQLInt8ArrayBinaryProtocolValue());
}
private static void setFloat4ArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT4_ARRAY,
new PostgreSQLFloat4ArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.FLOAT4_ARRAY, new
PostgreSQLFloat4ArrayBinaryProtocolValue());
}
private static void setFloat8ArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT8_ARRAY,
new PostgreSQLFloat8ArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.FLOAT8_ARRAY, new
PostgreSQLFloat8ArrayBinaryProtocolValue());
}
private static void setBoolArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_BOOL_ARRAY, new
PostgreSQLBoolArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.BOOL_ARRAY, new
PostgreSQLBoolArrayBinaryProtocolValue());
}
private static void setStringArrayBinaryProtocolValue() {
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR_ARRAY,
new PostgreSQLStringArrayBinaryProtocolValue());
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR_ARRAY, new
PostgreSQLStringArrayBinaryProtocolValue());
-
BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_TEXT_ARRAY, new
PostgreSQLStringArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.VARCHAR_ARRAY, new
PostgreSQLStringArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.CHAR_ARRAY, new
PostgreSQLStringArrayBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.TEXT_ARRAY, new
PostgreSQLStringArrayBinaryProtocolValue());
}
private static void setByteaBinaryProtocolValue() {
- BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.POSTGRESQL_TYPE_BYTEA,
new PostgreSQLByteaBinaryProtocolValue());
+ BINARY_PROTOCOL_VALUES.put(PostgreSQLColumnType.BYTEA, new
PostgreSQLByteaBinaryProtocolValue());
}
/**
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
index 74bd811e13f..b03f99b72c2 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacketTest.java
@@ -102,7 +102,7 @@ class PostgreSQLDataRowPacketTest {
@Test
void assertWriteBinaryNull() {
- PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(new
BinaryCell(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4, null)));
+ PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(new
BinaryCell(PostgreSQLColumnType.INT4, null)));
actual.write(payload);
verify(payload).writeInt2(1);
verify(payload).writeInt4(0xFFFFFFFF);
@@ -111,7 +111,7 @@ class PostgreSQLDataRowPacketTest {
@Test
void assertWriteBinaryInt4() {
final int value = 12345678;
- PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(new
BinaryCell(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4, value)));
+ PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(new
BinaryCell(PostgreSQLColumnType.INT4, value)));
actual.write(payload);
verify(payload).writeInt2(1);
verify(payload).writeInt4(4);
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnTypeTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnTypeTest.java
index c0ec9b800c1..b5ec12529e5 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnTypeTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnTypeTest.java
@@ -31,121 +31,121 @@ class PostgreSQLColumnTypeTest {
@Test
void assertValueOfJDBCTypeForTinyint() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.TINYINT);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.INT2));
}
@Test
void assertValueOfJDBCTypeForSmallint() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.SMALLINT);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.INT2));
}
@Test
void assertValueOfJDBCTypeForInteger() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.INTEGER);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.INT4));
}
@Test
void assertValueOfJDBCTypeForBigint() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BIGINT);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.INT8));
}
@Test
void assertValueOfJDBCTypeForNumeric() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.NUMERIC);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_NUMERIC));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.NUMERIC));
}
@Test
void assertValueOfJDBCTypeForDecimal() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.DECIMAL);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_NUMERIC));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.NUMERIC));
}
@Test
void assertValueOfJDBCTypeForReal() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.REAL);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT4));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.FLOAT4));
}
@Test
void assertValueOfJDBCTypeForDouble() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.DOUBLE);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT8));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.FLOAT8));
}
@Test
void assertValueOfJDBCTypeForChar() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.CHAR);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.CHAR));
}
@Test
void assertValueOfJDBCTypeForVarchar() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.VARCHAR);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.VARCHAR));
}
@Test
void assertValueOfJDBCTypeForBinary() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BINARY);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BYTEA));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.BYTEA));
}
@Test
void assertValueOfJDBCTypeForBit() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BIT);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BIT));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.BIT));
}
@Test
void assertValueOfPgTypeForBit() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BIT, "bit");
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BIT));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.BIT));
}
@Test
void assertValueOfPgTypeForBool() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BIT, "bool");
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BOOL));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.BOOL));
}
@Test
void assertValueOfJDBCTypeForDate() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.DATE);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_DATE));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.DATE));
}
@Test
void assertValueOfJDBCTypeForTime() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.TIME);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_TIME));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.TIME));
}
@Test
void assertValueOfJDBCTypeForTimestamp() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.TIMESTAMP);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_TIMESTAMP));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.TIMESTAMP));
}
@Test
void assertValueOfJDBCTypeForOther() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.OTHER);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_JSON));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.JSON));
}
@Test
void assertValueOfJDBCTypeForSQLXML() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.SQLXML);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_XML));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.XML));
}
@Test
void assertValueOfJDBCTypeForBoolean() {
PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOfJDBCType(Types.BOOLEAN);
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_BOOL));
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.BOOL));
}
@Test
@@ -155,8 +155,8 @@ class PostgreSQLColumnTypeTest {
@Test
void assertValueOf() {
- PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOf(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8.getValue());
- assertThat(sqlColumnType,
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8));
+ PostgreSQLColumnType sqlColumnType =
PostgreSQLColumnType.valueOf(PostgreSQLColumnType.INT8.getValue());
+ assertThat(sqlColumnType, is(PostgreSQLColumnType.INT8));
}
@Test
@@ -166,6 +166,6 @@ class PostgreSQLColumnTypeTest {
@Test
void assertGetValue() {
- assertThat(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8.getValue(),
is(20));
+ assertThat(PostgreSQLColumnType.INT8.getValue(), is(20));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
index 76dc6055720..d7a0563d348 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/PostgreSQLComBindPacketTest.java
@@ -43,7 +43,7 @@ class PostgreSQLComBindPacketTest {
PostgreSQLComBindPacket actual = new PostgreSQLComBindPacket(new
PostgreSQLPacketPayload(Unpooled.wrappedBuffer(BIND_MESSAGE_BYTES),
StandardCharsets.UTF_8));
assertThat(actual.getPortal(), is(""));
assertThat(actual.getStatementId(), is("S_1"));
-
assertThat(actual.readParameters(Collections.singletonList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4)),
is(Collections.singletonList(10)));
+
assertThat(actual.readParameters(Collections.singletonList(PostgreSQLColumnType.INT4)),
is(Collections.singletonList(10)));
assertTrue(actual.readResultFormats().isEmpty());
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
index 1940b26c3ab..cc9b0d8a8ed 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
@@ -28,66 +28,66 @@ class PostgreSQLBinaryProtocolValueFactoryTest {
@Test
void assertGetStringBinaryProtocolValueByVarchar() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.VARCHAR);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLStringBinaryProtocolValue.class));
}
@Test
void assertGetStringBinaryProtocolValueByChar() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.CHAR);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLStringBinaryProtocolValue.class));
}
@Test
void assertGetInt8BinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.INT8);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLInt8BinaryProtocolValue.class));
}
@Test
void assertGetInt4BinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.INT4);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLInt4BinaryProtocolValue.class));
}
@Test
void assertGetInt2BinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.INT2);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLInt2BinaryProtocolValue.class));
}
@Test
void assertGetDoubleBinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT8);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.FLOAT8);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLDoubleBinaryProtocolValue.class));
}
@Test
void assertGetFloatBinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT4);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.FLOAT4);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLFloatBinaryProtocolValue.class));
}
@Test
void assertGetNumericBinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_NUMERIC);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.NUMERIC);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLNumericBinaryProtocolValue.class));
}
@Test
void assertGetDateBinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_DATE);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.DATE);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLDateBinaryProtocolValue.class));
}
@Test
void assertGetTimeBinaryProtocolValue() {
- PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_TIMESTAMP);
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.TIMESTAMP);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLTimeBinaryProtocolValue.class));
}
@Test
void assertGetBinaryProtocolValueExThrown() {
- assertThrows(IllegalArgumentException.class, () ->
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_XML));
+ assertThrows(IllegalArgumentException.class, () ->
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.XML));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
index 78dc4ff35f0..16f36300dee 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/parse/PostgreSQLComParsePacketTest.java
@@ -49,6 +49,6 @@ class PostgreSQLComParsePacketTest {
assertThat(actual.getStatementId(), is("sql"));
List<PostgreSQLColumnType> types = actual.readParameterTypes();
assertThat(types.size(), is(1));
- assertThat(types.get(0),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED));
+ assertThat(types.get(0), is(PostgreSQLColumnType.UNSPECIFIED));
}
}
diff --git
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/binlog/BinlogContextTest.java
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/binlog/BinlogContextTest.java
index 40d841a1888..5a7409cef34 100644
---
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/binlog/BinlogContextTest.java
+++
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/binlog/BinlogContextTest.java
@@ -74,7 +74,7 @@ class BinlogContextTest {
void assertGetColumnDefs() {
binlogContext.putTableMapEvent(TEST_TABLE_ID, tableMapEventPacket);
List<MySQLBinlogColumnDef> columnDefs = new ArrayList<>(1);
- columnDefs.add(new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_LONG));
+ columnDefs.add(new MySQLBinlogColumnDef(MySQLBinaryColumnType.LONG));
when(tableMapEventPacket.getColumnDefs()).thenReturn(columnDefs);
assertThat(binlogContext.getColumnDefs(TEST_TABLE_ID), is(columnDefs));
}
diff --git
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoderTest.java
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoderTest.java
index e0fb747d164..651188775ff 100644
---
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoderTest.java
+++
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoderTest.java
@@ -74,8 +74,8 @@ class MySQLBinlogEventPacketDecoderTest {
binlogEventPacketDecoder = new MySQLBinlogEventPacketDecoder(4, new
ConcurrentHashMap<>(), true);
binlogContext = (BinlogContext)
Plugins.getMemberAccessor().get(MySQLBinlogEventPacketDecoder.class.getDeclaredField("binlogContext"),
binlogEventPacketDecoder);
when(channelHandlerContext.channel().attr(CommonConstants.CHARSET_ATTRIBUTE_KEY).get()).thenReturn(StandardCharsets.UTF_8);
- columnDefs = Lists.newArrayList(new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_LONGLONG), new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_LONG),
- new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR), new
MySQLBinlogColumnDef(MySQLBinaryColumnType.MYSQL_TYPE_NEWDECIMAL));
+ columnDefs = Lists.newArrayList(new
MySQLBinlogColumnDef(MySQLBinaryColumnType.LONGLONG), new
MySQLBinlogColumnDef(MySQLBinaryColumnType.LONG),
+ new MySQLBinlogColumnDef(MySQLBinaryColumnType.VARCHAR), new
MySQLBinlogColumnDef(MySQLBinaryColumnType.NEWDECIMAL));
}
@Test
diff --git
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java
index 11f513a7856..14a9a8c6baa 100644
---
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java
+++
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java
@@ -133,7 +133,7 @@ public final class MySQLComStmtPrepareExecutor implements
CommandExecutor {
result.add(createMySQLColumnDefinition41Packet(characterSet,
columnDefinitionFlag,
MySQLBinaryColumnType.valueOfJDBCType(column.getDataType())));
serverPreparedStatement.getParameterColumnDefinitionFlags().add(columnDefinitionFlag);
} else {
- result.add(createMySQLColumnDefinition41Packet(characterSet,
0, MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
+ result.add(createMySQLColumnDefinition41Packet(characterSet,
0, MySQLBinaryColumnType.VAR_STRING));
serverPreparedStatement.getParameterColumnDefinitionFlags().add(0);
}
}
@@ -151,9 +151,9 @@ public final class MySQLComStmtPrepareExecutor implements
CommandExecutor {
if (each instanceof ColumnProjection) {
result.add(Optional.ofNullable(columnToTableMap.get(each.getExpression())).map(schema::getTable).map(table
-> table.getColumn(((ColumnProjection) each).getName()))
.map(column ->
createMySQLColumnDefinition41Packet(characterSet,
calculateColumnDefinitionFlag(column),
MySQLBinaryColumnType.valueOfJDBCType(column.getDataType())))
- .orElseGet(() ->
createMySQLColumnDefinition41Packet(characterSet, 0,
MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING)));
+ .orElseGet(() ->
createMySQLColumnDefinition41Packet(characterSet, 0,
MySQLBinaryColumnType.VAR_STRING)));
} else {
- result.add(createMySQLColumnDefinition41Packet(characterSet,
0, MySQLBinaryColumnType.MYSQL_TYPE_VAR_STRING));
+ result.add(createMySQLColumnDefinition41Packet(characterSet,
0, MySQLBinaryColumnType.VAR_STRING));
}
}
return result;
diff --git
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
index 130ac38fd50..40c8e6b772a 100644
---
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
+++
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
@@ -80,7 +80,7 @@ public final class MySQLComFieldListPacketExecutor implements
CommandExecutor {
while (databaseConnector.next()) {
String columnName =
databaseConnector.getRowData().getCells().iterator().next().getData().toString();
result.add(new MySQLColumnDefinition41Packet(
- characterSet, databaseName, packet.getTable(),
packet.getTable(), columnName, columnName, 100,
MySQLBinaryColumnType.MYSQL_TYPE_VARCHAR, 0, true));
+ characterSet, databaseName, packet.getTable(),
packet.getTable(), columnName, columnName, 100, MySQLBinaryColumnType.VARCHAR,
0, true));
}
result.add(new
MySQLEofPacket(ServerStatusFlagCalculator.calculateFor(connectionSession)));
return result;
diff --git
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
index 1521a138387..96f7b28ff7b 100644
---
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
+++
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
@@ -158,7 +158,7 @@ public final class PostgreSQLComDescribeExecutor implements
CommandExecutor {
Collection<Integer> result = new HashSet<>();
ListIterator<PostgreSQLColumnType> parameterTypesListIterator =
preparedStatement.getParameterTypes().listIterator();
for (int index = parameterTypesListIterator.nextIndex();
parameterTypesListIterator.hasNext(); index =
parameterTypesListIterator.nextIndex()) {
- if (PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED ==
parameterTypesListIterator.next()) {
+ if (PostgreSQLColumnType.UNSPECIFIED ==
parameterTypesListIterator.next()) {
result.add(index);
}
}
@@ -255,12 +255,12 @@ public final class PostgreSQLComDescribeExecutor
implements CommandExecutor {
private void populateParameterTypes(final
PostgreSQLServerPreparedStatement logicPreparedStatement, final
PreparedStatement actualPreparedStatement) throws SQLException {
if (0 ==
logicPreparedStatement.getSqlStatementContext().getSqlStatement().getParameterCount()
- ||
logicPreparedStatement.getParameterTypes().stream().noneMatch(each ->
PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED == each)) {
+ ||
logicPreparedStatement.getParameterTypes().stream().noneMatch(each ->
PostgreSQLColumnType.UNSPECIFIED == each)) {
return;
}
ParameterMetaData parameterMetaData =
actualPreparedStatement.getParameterMetaData();
for (int i = 0; i <
logicPreparedStatement.getSqlStatementContext().getSqlStatement().getParameterCount();
i++) {
- if (PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED ==
logicPreparedStatement.getParameterTypes().get(i)) {
+ if (PostgreSQLColumnType.UNSPECIFIED ==
logicPreparedStatement.getParameterTypes().get(i)) {
logicPreparedStatement.getParameterTypes().set(i,
PostgreSQLColumnType.valueOfJDBCType(parameterMetaData.getParameterType(i + 1),
parameterMetaData.getParameterTypeName(i + 1)));
}
}
diff --git
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutor.java
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutor.java
index 2397eee4d7c..d132ce68ef4 100644
---
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutor.java
+++
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutor.java
@@ -99,7 +99,7 @@ public final class PostgreSQLComParseExecutor implements
CommandExecutor {
result.addAll(specifiedColumnTypes);
int unspecifiedCount = parameterCount - specifiedColumnTypes.size();
for (int i = 0; i < unspecifiedCount; i++) {
- result.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ result.add(PostgreSQLColumnType.UNSPECIFIED);
}
return result;
}
diff --git
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
index 644da5f06b5..e85466f8750 100644
---
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
+++
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
@@ -112,7 +112,7 @@ class
PostgreSQLAggregatedBatchedStatementsCommandExecutorTest {
when(result.getConnectionContext()).thenReturn(new
ConnectionContext());
when(result.getServerPreparedStatementRegistry()).thenReturn(new
ServerPreparedStatementRegistry());
result.getServerPreparedStatementRegistry().addPreparedStatement(STATEMENT_ID,
- new PostgreSQLServerPreparedStatement(SQL,
sqlStatementContext,
Collections.singletonList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4)));
+ new PostgreSQLServerPreparedStatement(SQL,
sqlStatementContext, Collections.singletonList(PostgreSQLColumnType.INT4)));
when(result.getConnectionId()).thenReturn(CONNECTION_ID);
ProxyDatabaseConnectionManager databaseConnectionManager =
mock(ProxyDatabaseConnectionManager.class);
Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
@@ -133,7 +133,7 @@ class
PostgreSQLAggregatedBatchedStatementsCommandExecutorTest {
for (int i = 0; i < BATCH_SIZE; i++) {
PostgreSQLComBindPacket bindPacket =
mock(PostgreSQLComBindPacket.class);
when(bindPacket.getStatementId()).thenReturn(STATEMENT_ID);
-
when(bindPacket.readParameters(Collections.singletonList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4))).thenReturn(Collections.singletonList(i));
+
when(bindPacket.readParameters(Collections.singletonList(PostgreSQLColumnType.INT4))).thenReturn(Collections.singletonList(i));
PostgreSQLComDescribePacket describePacket =
mock(PostgreSQLComDescribePacket.class);
PostgreSQLComExecutePacket executePacket =
mock(PostgreSQLComExecutePacket.class);
result.add(bindPacket);
diff --git
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
index c982426f7af..d9c67ec5b8a 100644
---
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
+++
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
@@ -93,7 +93,7 @@ class PostgreSQLBatchedStatementsExecutorTest {
ContextManager contextManager = mockContextManager();
ConnectionSession connectionSession = mockConnectionSession();
PostgreSQLServerPreparedStatement postgreSQLPreparedStatement = new
PostgreSQLServerPreparedStatement("insert into t (id, col) values (?, ?)",
mockInsertStatementContext(),
- Arrays.asList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4,
PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR));
+ Arrays.asList(PostgreSQLColumnType.INT4,
PostgreSQLColumnType.VARCHAR));
List<List<Object>> parameterSets = Arrays.asList(Arrays.asList(1, new
PostgreSQLTypeUnspecifiedSQLParameter("foo")),
Arrays.asList(2, new
PostgreSQLTypeUnspecifiedSQLParameter("bar")), Arrays.asList(3, new
PostgreSQLTypeUnspecifiedSQLParameter("baz")));
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
diff --git
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
index 75d108abad8..88c41f45d20 100644
---
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
+++
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
@@ -134,7 +134,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatement sqlStatement = SQL_PARSER_ENGINE.parse(sql, false);
List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(sqlStatement.getParameterCount());
for (int i = 0; i < sqlStatement.getParameterCount(); i++) {
-
parameterTypes.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ parameterTypes.add(PostgreSQLColumnType.UNSPECIFIED);
}
SQLStatementContext sqlStatementContext =
mock(InsertStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
@@ -164,7 +164,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatement sqlStatement = SQL_PARSER_ENGINE.parse(sql, false);
List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(sqlStatement.getParameterCount());
for (int i = 0; i < sqlStatement.getParameterCount(); i++) {
-
parameterTypes.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ parameterTypes.add(PostgreSQLColumnType.UNSPECIFIED);
}
SQLStatementContext sqlStatementContext =
mock(InsertStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
@@ -194,7 +194,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatement sqlStatement = SQL_PARSER_ENGINE.parse(sql, false);
List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(sqlStatement.getParameterCount());
for (int i = 0; i < sqlStatement.getParameterCount(); i++) {
-
parameterTypes.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ parameterTypes.add(PostgreSQLColumnType.UNSPECIFIED);
}
SQLStatementContext sqlStatementContext =
mock(InsertStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
@@ -224,7 +224,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatement sqlStatement = SQL_PARSER_ENGINE.parse(sql, false);
List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(sqlStatement.getParameterCount());
for (int i = 0; i < sqlStatement.getParameterCount(); i++) {
-
parameterTypes.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ parameterTypes.add(PostgreSQLColumnType.UNSPECIFIED);
}
SQLStatementContext sqlStatementContext =
mock(InsertStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
@@ -246,7 +246,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatement sqlStatement = SQL_PARSER_ENGINE.parse(sql, false);
List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(sqlStatement.getParameterCount());
for (int i = 0; i < sqlStatement.getParameterCount(); i++) {
-
parameterTypes.add(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED);
+ parameterTypes.add(PostgreSQLColumnType.UNSPECIFIED);
}
SQLStatementContext sqlStatementContext =
mock(InsertStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
@@ -273,43 +273,43 @@ class PostgreSQLComDescribeExecutorTest {
List<PostgreSQLColumnDescription> actualColumnDescriptions = new
ArrayList<>(getColumnDescriptionsFromPacket(actualRowDescriptionPacket));
assertThat(actualColumnDescriptions.size(), is(13));
assertThat(actualColumnDescriptions.get(0).getColumnName(), is("id"));
- assertThat(actualColumnDescriptions.get(0).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue()));
+ assertThat(actualColumnDescriptions.get(0).getTypeOID(),
is(PostgreSQLColumnType.INT4.getValue()));
assertThat(actualColumnDescriptions.get(0).getColumnLength(), is(4));
assertThat(actualColumnDescriptions.get(1).getColumnName(),
is("alias_id"));
- assertThat(actualColumnDescriptions.get(1).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue()));
+ assertThat(actualColumnDescriptions.get(1).getTypeOID(),
is(PostgreSQLColumnType.INT4.getValue()));
assertThat(actualColumnDescriptions.get(1).getColumnLength(), is(4));
assertThat(actualColumnDescriptions.get(2).getColumnName(),
is("?column?"));
- assertThat(actualColumnDescriptions.get(2).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(2).getTypeOID(),
is(PostgreSQLColumnType.VARCHAR.getValue()));
assertThat(actualColumnDescriptions.get(2).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(3).getColumnName(),
is("literal_string"));
- assertThat(actualColumnDescriptions.get(3).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(3).getTypeOID(),
is(PostgreSQLColumnType.VARCHAR.getValue()));
assertThat(actualColumnDescriptions.get(3).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(4).getColumnName(),
is("literal_int"));
- assertThat(actualColumnDescriptions.get(4).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue()));
+ assertThat(actualColumnDescriptions.get(4).getTypeOID(),
is(PostgreSQLColumnType.INT4.getValue()));
assertThat(actualColumnDescriptions.get(4).getColumnLength(), is(4));
assertThat(actualColumnDescriptions.get(5).getColumnName(),
is("literal_bigint"));
- assertThat(actualColumnDescriptions.get(5).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8.getValue()));
+ assertThat(actualColumnDescriptions.get(5).getTypeOID(),
is(PostgreSQLColumnType.INT8.getValue()));
assertThat(actualColumnDescriptions.get(5).getColumnLength(), is(8));
assertThat(actualColumnDescriptions.get(6).getColumnName(),
is("literal_numeric"));
- assertThat(actualColumnDescriptions.get(6).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_NUMERIC.getValue()));
+ assertThat(actualColumnDescriptions.get(6).getTypeOID(),
is(PostgreSQLColumnType.NUMERIC.getValue()));
assertThat(actualColumnDescriptions.get(6).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(7).getColumnName(), is("id"));
- assertThat(actualColumnDescriptions.get(7).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue()));
+ assertThat(actualColumnDescriptions.get(7).getTypeOID(),
is(PostgreSQLColumnType.INT4.getValue()));
assertThat(actualColumnDescriptions.get(7).getColumnLength(), is(4));
assertThat(actualColumnDescriptions.get(8).getColumnName(), is("k"));
- assertThat(actualColumnDescriptions.get(8).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue()));
+ assertThat(actualColumnDescriptions.get(8).getTypeOID(),
is(PostgreSQLColumnType.INT4.getValue()));
assertThat(actualColumnDescriptions.get(8).getColumnLength(), is(4));
assertThat(actualColumnDescriptions.get(9).getColumnName(), is("c"));
- assertThat(actualColumnDescriptions.get(9).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(9).getTypeOID(),
is(PostgreSQLColumnType.CHAR.getValue()));
assertThat(actualColumnDescriptions.get(9).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(10).getColumnName(),
is("pad"));
- assertThat(actualColumnDescriptions.get(10).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_CHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(10).getTypeOID(),
is(PostgreSQLColumnType.CHAR.getValue()));
assertThat(actualColumnDescriptions.get(10).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(11).getColumnName(),
is("t_order"));
- assertThat(actualColumnDescriptions.get(11).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(11).getTypeOID(),
is(PostgreSQLColumnType.VARCHAR.getValue()));
assertThat(actualColumnDescriptions.get(11).getColumnLength(), is(-1));
assertThat(actualColumnDescriptions.get(12).getColumnName(),
is("alias_t_order"));
- assertThat(actualColumnDescriptions.get(12).getTypeOID(),
is(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR.getValue()));
+ assertThat(actualColumnDescriptions.get(12).getTypeOID(),
is(PostgreSQLColumnType.VARCHAR.getValue()));
assertThat(actualColumnDescriptions.get(12).getColumnLength(), is(-1));
}
@@ -329,7 +329,7 @@ class PostgreSQLComDescribeExecutorTest {
SQLStatementContext sqlStatementContext =
mock(SelectStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
prepareJDBCBackendConnection(sql);
- List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(Collections.singleton(PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED));
+ List<PostgreSQLColumnType> parameterTypes = new
ArrayList<>(Collections.singleton(PostgreSQLColumnType.UNSPECIFIED));
ContextManager contextManager = mockContextManager();
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
ShardingSphereDatabase database =
contextManager.getMetaDataContexts().getMetaData().getDatabase(DATABASE_NAME);
@@ -343,7 +343,7 @@ class PostgreSQLComDescribeExecutorTest {
PostgreSQLPacketPayload mockPayload =
mock(PostgreSQLPacketPayload.class);
actualParameterDescription.write(mockPayload);
verify(mockPayload).writeInt2(1);
-
verify(mockPayload).writeInt4(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4.getValue());
+ verify(mockPayload).writeInt4(PostgreSQLColumnType.INT4.getValue());
PostgreSQLRowDescriptionPacket actualRowDescription =
(PostgreSQLRowDescriptionPacket) actualPacketsIterator.next();
List<PostgreSQLColumnDescription> actualColumnDescriptions =
getColumnDescriptions(actualRowDescription);
List<PostgreSQLColumnDescription> expectedColumnDescriptions =
Arrays.asList(
diff --git
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutorTest.java
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutorTest.java
index 623e842b609..9667e79c445 100644
---
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutorTest.java
+++
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutorTest.java
@@ -100,7 +100,7 @@ class PostgreSQLComParseExecutorTest {
final String statementId = "S_2";
when(parsePacket.getSQL()).thenReturn(rawSQL);
when(parsePacket.getStatementId()).thenReturn(statementId);
-
when(parsePacket.readParameterTypes()).thenReturn(Collections.singletonList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4));
+
when(parsePacket.readParameterTypes()).thenReturn(Collections.singletonList(PostgreSQLColumnType.INT4));
when(connectionSession.getDefaultDatabaseName()).thenReturn("foo_db");
Plugins.getMemberAccessor().set(PostgreSQLComParseExecutor.class.getDeclaredField("connectionSession"),
executor, connectionSession);
ContextManager contextManager = mockContextManager();
@@ -112,7 +112,7 @@ class PostgreSQLComParseExecutorTest {
assertThat(actualPreparedStatement.getSqlStatementContext(),
instanceOf(InsertStatementContext.class));
assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(),
instanceOf(PostgreSQLInsertStatement.class));
assertThat(actualPreparedStatement.getSql(), is(expectedSQL));
- assertThat(actualPreparedStatement.getParameterTypes(),
is(Arrays.asList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4,
PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED)));
+ assertThat(actualPreparedStatement.getParameterTypes(),
is(Arrays.asList(PostgreSQLColumnType.INT4, PostgreSQLColumnType.UNSPECIFIED)));
}
@Test