This is an automated email from the ASF dual-hosted git repository.
panjuan 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 201b83c356f Refactor SQLErrorCode (#20138)
201b83c356f is described below
commit 201b83c356fe9ee4d588de7535ea59ab3bfd61dd
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Aug 13 13:42:48 2022 +0800
Refactor SQLErrorCode (#20138)
---
.../mysql/packet/generic/MySQLErrPacket.java | 2 +-
.../mysql/packet/generic/MySQLErrPacketTest.java | 12 +++----
.../shardingsphere/error/SQLExceptionHandler.java | 2 +-
.../shardingsphere/error/code/SQLErrorCode.java | 24 +++++++-------
.../error/code/StandardSQLErrorCode.java | 26 +++++++--------
.../error/code/StandardSQLErrorCodeTest.java | 12 +++----
.../error/mysql/code/MySQLErrorCode.java | 38 ++++++++++------------
.../error/mysql/mapper/MySQLExceptionMapper.java | 2 +-
.../error/mysql/code/MySQLErrorCodeTest.java | 12 +++----
.../ral/common/exception/DistSQLErrorCode.java | 10 +++---
10 files changed, 68 insertions(+), 72 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
index c87a3e79024..f0107578fa5 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacket.java
@@ -49,7 +49,7 @@ public final class MySQLErrPacket implements MySQLPacket {
private final String errorMessage;
public MySQLErrPacket(final int sequenceId, final SQLErrorCode
sqlErrorCode, final Object... errorMessageArguments) {
- this(sequenceId, sqlErrorCode.getErrorCode(),
sqlErrorCode.getSqlState(), String.format(sqlErrorCode.getErrorMessage(),
errorMessageArguments));
+ this(sequenceId, sqlErrorCode.getVendorCode(),
sqlErrorCode.getSqlState(), String.format(sqlErrorCode.getReason(),
errorMessageArguments));
}
public MySQLErrPacket(final MySQLPacketPayload payload) {
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
index 1474eda78c9..e90859336e3 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/generic/MySQLErrPacketTest.java
@@ -39,23 +39,23 @@ public final class MySQLErrPacketTest {
public void assertNewErrPacketWithServerErrorCode() {
MySQLErrPacket actual = new MySQLErrPacket(1,
MySQLErrorCode.ER_ACCESS_DENIED_ERROR, "root", "localhost", "root");
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorCode()));
+ assertThat(actual.getErrorCode(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getVendorCode()));
assertThat(actual.getSqlState(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getSqlState()));
- assertThat(actual.getErrorMessage(),
is(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorMessage(),
"root", "localhost", "root")));
+ assertThat(actual.getErrorMessage(),
is(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getReason(), "root",
"localhost", "root")));
}
@Test
public void assertNewErrPacketWithPayload() {
when(payload.readInt1()).thenReturn(1, MySQLErrPacket.HEADER);
-
when(payload.readInt2()).thenReturn(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorCode());
+
when(payload.readInt2()).thenReturn(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getVendorCode());
when(payload.readStringFix(1)).thenReturn("#");
when(payload.readStringFix(5)).thenReturn(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getSqlState());
-
when(payload.readStringEOF()).thenReturn(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorMessage(),
"root", "localhost", "root"));
+
when(payload.readStringEOF()).thenReturn(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getReason(),
"root", "localhost", "root"));
MySQLErrPacket actual = new MySQLErrPacket(payload);
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorCode()));
+ assertThat(actual.getErrorCode(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getVendorCode()));
assertThat(actual.getSqlState(),
is(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getSqlState()));
- assertThat(actual.getErrorMessage(),
is(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorMessage(),
"root", "localhost", "root")));
+ assertThat(actual.getErrorMessage(),
is(String.format(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getReason(), "root",
"localhost", "root")));
}
@Test
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/SQLExceptionHandler.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/SQLExceptionHandler.java
index 3f1716bc89a..4305b67c29a 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/SQLExceptionHandler.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/SQLExceptionHandler.java
@@ -81,6 +81,6 @@ public final class SQLExceptionHandler {
}
private static SQLException toSQLException(final SQLErrorCode errorCode,
final Object... messageArguments) {
- return new SQLException(String.format(errorCode.getErrorMessage(),
messageArguments), errorCode.getSqlState(), errorCode.getErrorCode());
+ return new SQLException(String.format(errorCode.getReason(),
messageArguments), errorCode.getSqlState(), errorCode.getVendorCode());
}
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
index 1a2c4a222ee..dfb62e7d363 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/SQLErrorCode.java
@@ -22,13 +22,6 @@ package org.apache.shardingsphere.error.code;
*/
public interface SQLErrorCode {
- /**
- * Get error code.
- *
- * @return error code
- */
- int getErrorCode();
-
/**
* Get SQL state.
*
@@ -36,10 +29,17 @@ public interface SQLErrorCode {
*/
String getSqlState();
- /**MySQLErrPacketFactory
- * Get error message.
- *
- * @return error message
+ /**
+ * Get database vendor code.
+ *
+ * @return vendor code
+ */
+ int getVendorCode();
+
+ /**
+ * Get reason.
+ *
+ * @return reason
*/
- String getErrorMessage();
+ String getReason();
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/StandardSQLErrorCode.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/StandardSQLErrorCode.java
index 5c53b48c90c..89688ef664c 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/StandardSQLErrorCode.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/code/StandardSQLErrorCode.java
@@ -27,29 +27,29 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum StandardSQLErrorCode implements SQLErrorCode {
- CIRCUIT_BREAK_MODE(1000, "C1000", "Circuit break mode is ON"),
+ CIRCUIT_BREAK_MODE("C1000", 1000, "Circuit break mode is ON"),
- SCALING_JOB_NOT_EXIST(1201, "C1201", "Scaling job `%s` does not exist"),
+ SCALING_JOB_NOT_EXIST("C1201", 1201, "Scaling job `%s` does not exist"),
- SCALING_OPERATE_FAILED(1209, "C1209", "Scaling Operate Failed: `%s`"),
+ SCALING_OPERATE_FAILED("C1209", 1209, "Scaling Operate Failed: `%s`"),
- DATABASE_WRITE_LOCKED(1300, "C1300", "The database `%s` is read-only"),
+ DATABASE_WRITE_LOCKED("C1300", 1300, "The database `%s` is read-only"),
- TABLE_LOCK_WAIT_TIMEOUT(1301, "C1301", "The table `%s` of schema `%s` lock
wait timeout of %s ms exceeded"),
+ TABLE_LOCK_WAIT_TIMEOUT("C1301", 1301, "The table `%s` of schema `%s` lock
wait timeout of %s ms exceeded"),
- TABLE_LOCKED(1302, "C1302", "The table `%s` of schema `%s` is locked"),
+ TABLE_LOCKED("C1302", 1302, "The table `%s` of schema `%s` is locked"),
- RESOURCE_OR_RULE_NOT_EXIST(1305, "42000", "Data source or rule does not
exist"),
+ RESOURCE_OR_RULE_NOT_EXIST("42000", 1305, "Data source or rule does not
exist"),
- UNSUPPORTED_SQL(1235, "42000", "Unsupported SQL: %s"),
+ UNSUPPORTED_SQL("42000", 1235, "Unsupported SQL: %s"),
- UNSUPPORTED_COMMAND(1998, "C1998", "Unsupported command: %s"),
+ UNSUPPORTED_COMMAND("C1998", 1998, "Unsupported command: %s"),
- UNKNOWN_EXCEPTION(1999, "C1999", "Unknown exception: %s");
-
- private final int errorCode;
+ UNKNOWN_EXCEPTION("C1999", 1999, "Unknown exception: %s");
private final String sqlState;
- private final String errorMessage;
+ private final int vendorCode;
+
+ private final String reason;
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/StandardSQLErrorCodeTest.java
b/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/StandardSQLErrorCodeTest.java
index 0e9e041d4a7..21f90a212ac 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/StandardSQLErrorCodeTest.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/test/java/org/apache/shardingsphere/error/code/StandardSQLErrorCodeTest.java
@@ -26,22 +26,22 @@ public final class StandardSQLErrorCodeTest {
@Test
public void assertCircuitBreakMode() {
- assertThat(StandardSQLErrorCode.CIRCUIT_BREAK_MODE.getErrorCode(),
is(1000));
+ assertThat(StandardSQLErrorCode.CIRCUIT_BREAK_MODE.getVendorCode(),
is(1000));
assertThat(StandardSQLErrorCode.CIRCUIT_BREAK_MODE.getSqlState(),
is("C1000"));
- assertThat(StandardSQLErrorCode.CIRCUIT_BREAK_MODE.getErrorMessage(),
is("Circuit break mode is ON"));
+ assertThat(StandardSQLErrorCode.CIRCUIT_BREAK_MODE.getReason(),
is("Circuit break mode is ON"));
}
@Test
public void assertUnsupportedCommand() {
- assertThat(StandardSQLErrorCode.UNSUPPORTED_COMMAND.getErrorCode(),
is(1998));
+ assertThat(StandardSQLErrorCode.UNSUPPORTED_COMMAND.getVendorCode(),
is(1998));
assertThat(StandardSQLErrorCode.UNSUPPORTED_COMMAND.getSqlState(),
is("C1998"));
- assertThat(StandardSQLErrorCode.UNSUPPORTED_COMMAND.getErrorMessage(),
is("Unsupported command: %s"));
+ assertThat(StandardSQLErrorCode.UNSUPPORTED_COMMAND.getReason(),
is("Unsupported command: %s"));
}
@Test
public void assertUnknownException() {
- assertThat(StandardSQLErrorCode.UNKNOWN_EXCEPTION.getErrorCode(),
is(1999));
+ assertThat(StandardSQLErrorCode.UNKNOWN_EXCEPTION.getVendorCode(),
is(1999));
assertThat(StandardSQLErrorCode.UNKNOWN_EXCEPTION.getSqlState(),
is("C1999"));
- assertThat(StandardSQLErrorCode.UNKNOWN_EXCEPTION.getErrorMessage(),
is("Unknown exception: %s"));
+ assertThat(StandardSQLErrorCode.UNKNOWN_EXCEPTION.getReason(),
is("Unknown exception: %s"));
}
}
diff --git
a/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCode.java
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCode.java
index 8e59dbf38f4..9c1ecc601a3 100644
---
a/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCode.java
+++
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCode.java
@@ -30,43 +30,39 @@ import org.apache.shardingsphere.error.code.SQLErrorCode;
@Getter
public enum MySQLErrorCode implements SQLErrorCode {
- ER_DBACCESS_DENIED_ERROR(1044, "42000", "Access denied for user '%s'@'%s'
to database '%s'"),
+ ER_DBACCESS_DENIED_ERROR("42000", 1044, "Access denied for user '%s'@'%s'
to database '%s'"),
- ER_ACCESS_DENIED_ERROR(1045, "28000", "Access denied for user '%s'@'%s'
(using password: %s)"),
+ ER_ACCESS_DENIED_ERROR("28000", 1045, "Access denied for user '%s'@'%s'
(using password: %s)"),
- ER_NO_DB_ERROR(1046, "3D000", "No database selected"),
+ ER_NO_DB_ERROR("3D000", 1046, "No database selected"),
- ER_BAD_DB_ERROR(1049, "42000", "Unknown database '%s'"),
+ ER_BAD_DB_ERROR("42000", 1049, "Unknown database '%s'"),
- ER_INTERNAL_ERROR(1815, "HY000", "Internal error: %s"),
+ ER_INTERNAL_ERROR("HY000", 1815, "Internal error: %s"),
- ER_UNSUPPORTED_PS(1295, "HY000", "This command is not supported in the
prepared statement protocol yet"),
+ ER_UNSUPPORTED_PS("HY000", 1295, "This command is not supported in the
prepared statement protocol yet"),
- ER_DB_CREATE_EXISTS_ERROR(1007, "HY000", "Can't create database '%s';
database exists"),
+ ER_DB_CREATE_EXISTS_ERROR("HY000", 1007, "Can't create database '%s';
database exists"),
- ER_DB_DROP_NOT_EXISTS_ERROR(1008, "HY000", "Can't drop database '%s';
database doesn't exist"),
+ ER_DB_DROP_NOT_EXISTS_ERROR("HY000", 1008, "Can't drop database '%s';
database doesn't exist"),
- ER_TABLE_EXISTS_ERROR(1050, "42S01", "Table '%s' already exists"),
+ ER_TABLE_EXISTS_ERROR("42S01", 1050, "Table '%s' already exists"),
- ER_NO_SUCH_TABLE(1146, "42S02", "Table '%s' doesn't exist"),
+ ER_NO_SUCH_TABLE("42S02", 1146, "Table '%s' doesn't exist"),
- ER_NOT_SUPPORTED_YET(1235, "42000", "This version of ShardingSphere-Proxy
doesn't yet support this SQL. '%s'"),
+ ER_CON_COUNT_ERROR("HY000", 1040, "Too many connections"),
- ER_SP_DOES_NOT_EXIST(1305, "42000", "Message: Data Source or
ShardingSphere rule does not exist"),
+ ER_UNKNOWN_CHARACTER_SET("42000", 1115, "Unknown character set: '%s'"),
- ER_CON_COUNT_ERROR(1040, "HY000", "Too many connections"),
+ ER_WRONG_VALUE_COUNT_ON_ROW("21S01", 1136, "Column count doesn't match
value count at row %d"),
- ER_UNKNOWN_CHARACTER_SET(1115, "42000", "Unknown character set: '%s'"),
-
- ER_WRONG_VALUE_COUNT_ON_ROW(1136, "21S01", "Column count doesn't match
value count at row %d"),
-
- ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE(3176, "HY000",
+ ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE("HY000", 3176,
"Please do not modify the %s table with an XA transaction. This is
an internal system table used to store GTIDs for committed transactions. "
+ "Although modifying it can lead to an inconsistent GTID
state, if necessary you can modify it with a non-XA transaction.");
- private final int errorCode;
-
private final String sqlState;
- private final String errorMessage;
+ private final int vendorCode;
+
+ private final String reason;
}
diff --git
a/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLExceptionMapper.java
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLExceptionMapper.java
index aa10b528ec9..b5d86764327 100644
---
a/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLExceptionMapper.java
+++
b/shardingsphere-error/shardingsphere-mysql-error/src/main/java/org/apache/shardingsphere/error/mysql/mapper/MySQLExceptionMapper.java
@@ -74,7 +74,7 @@ public final class MySQLExceptionMapper implements
DialectSQLExceptionMapper {
}
private SQLException toSQLException(final SQLErrorCode errorCode, final
Object... messageArguments) {
- return new SQLException(String.format(errorCode.getErrorMessage(),
messageArguments), errorCode.getSqlState(), errorCode.getErrorCode());
+ return new SQLException(String.format(errorCode.getReason(),
messageArguments), errorCode.getSqlState(), errorCode.getVendorCode());
}
@Override
diff --git
a/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCodeTest.java
b/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCodeTest.java
index 64a52671c1f..0dc33055a6c 100644
---
a/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCodeTest.java
+++
b/shardingsphere-error/shardingsphere-mysql-error/src/test/java/org/apache/shardingsphere/error/mysql/code/MySQLErrorCodeTest.java
@@ -26,23 +26,23 @@ public final class MySQLErrorCodeTest {
@Test
public void assertAccessDeniedError() {
- assertThat(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorCode(),
is(1045));
+ assertThat(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getVendorCode(),
is(1045));
assertThat(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getSqlState(),
is("28000"));
- assertThat(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getErrorMessage(),
is("Access denied for user '%s'@'%s' (using password: %s)"));
+ assertThat(MySQLErrorCode.ER_ACCESS_DENIED_ERROR.getReason(),
is("Access denied for user '%s'@'%s' (using password: %s)"));
}
@Test
public void assertBadDbError() {
- assertThat(MySQLErrorCode.ER_BAD_DB_ERROR.getErrorCode(), is(1049));
+ assertThat(MySQLErrorCode.ER_BAD_DB_ERROR.getVendorCode(), is(1049));
assertThat(MySQLErrorCode.ER_BAD_DB_ERROR.getSqlState(), is("42000"));
- assertThat(MySQLErrorCode.ER_BAD_DB_ERROR.getErrorMessage(),
is("Unknown database '%s'"));
+ assertThat(MySQLErrorCode.ER_BAD_DB_ERROR.getReason(), is("Unknown
database '%s'"));
}
@Test
public void assertErrorOnModifyingGtidExecutedTable() {
-
assertThat(MySQLErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE.getErrorCode(),
is(3176));
+
assertThat(MySQLErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE.getVendorCode(),
is(3176));
assertThat(MySQLErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE.getSqlState(),
is("HY000"));
-
assertThat(MySQLErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE.getErrorMessage(),
is("Please do not modify the %s table with an XA transaction. "
+
assertThat(MySQLErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE.getReason(),
is("Please do not modify the %s table with an XA transaction. "
+ "This is an internal system table used to store GTIDs for
committed transactions. "
+ "Although modifying it can lead to an inconsistent GTID
state, if necessary you can modify it with a non-XA transaction."));
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
index a0e9943d1be..2b853860871 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
@@ -28,15 +28,15 @@ import org.apache.shardingsphere.error.code.SQLErrorCode;
@Getter
public enum DistSQLErrorCode implements SQLErrorCode {
- UNSUPPORTED_VARIABLE(11001, "11001", "Could not support variable `%s`."),
+ UNSUPPORTED_VARIABLE("11001", 11001, "Could not support variable `%s`."),
- INVALID_VALUE(11002, "11002", "Invalid value `%s`.");
-
- private final int errorCode;
+ INVALID_VALUE("11002", 11002, "Invalid value `%s`.");
private final String sqlState;
- private final String errorMessage;
+ private final int vendorCode;
+
+ private final String reason;
/**
* Value of dist SQL error code.