You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by yx...@apache.org on 2022/09/09 15:21:50 UTC
[shardingsphere] branch master updated: Refactor FeatureSQLException and impl (#20906)
This is an automated email from the ASF dual-hosted git repository.
yx9o 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 0a896358e01 Refactor FeatureSQLException and impl (#20906)
0a896358e01 is described below
commit 0a896358e01a003fbb61f213f6f2add55dc50de6
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Sep 9 23:21:41 2022 +0800
Refactor FeatureSQLException and impl (#20906)
---
.../user-manual/error-code/sql-error-code.cn.md | 4 +-
.../user-manual/error-code/sql-error-code.en.md | 4 +-
...Exception.java => DBDiscoverySQLException.java} | 14 ++++---
.../InvalidMGRGroupNameConfigurationException.java | 5 +--
.../mysql/exception/InvalidMGRModeException.java | 5 +--
.../mysql/exception/InvalidMGRPluginException.java | 5 +--
.../InvalidMGRReplicationGroupMemberException.java | 5 +--
.../EncryptAlgorithmInitializationException.java | 5 +--
.../exception/EncryptColumnAlterException.java | 5 +--
.../exception/EncryptColumnNotFoundException.java | 5 +--
.../EncryptLogicColumnNotFoundException.java | 5 +--
.../encrypt/exception/EncryptSQLException.java | 16 +++----
.../UnsupportedEncryptInsertValueException.java | 5 +--
.../exception/UnsupportedEncryptSQLException.java | 5 +--
.../shadow/validator/ShadowValueValidator.java | 2 +-
.../shadow/exception/ShadowSQLException.java | 16 +++----
.../UnsupportedShadowColumnTypeException.java | 7 ++--
.../UnsupportedShadowInsertValueException.java | 7 ++--
.../dml/ShadowInsertStatementRoutingEngine.java | 2 +-
.../ColumnRegexMatchShadowAlgorithmTest.java | 2 +-
.../ColumnValueMatchShadowAlgorithmTest.java | 2 +-
.../shadow/validator/ShadowValueValidatorTest.java | 2 +-
...lDataNodesMissedWithShardingTableException.java | 3 +-
.../exception/ActualTableNotFoundException.java | 3 +-
.../exception/BindingTableNotFoundException.java | 3 +-
.../exception/CursorNameNotFoundException.java | 5 +--
.../DMLMultipleDataNodesWithLimitException.java | 3 +-
.../DMLWithMultipleShardingTablesException.java | 3 +-
.../exception/DataNodeGenerateException.java | 3 +-
.../DataSourceIntersectionNotFoundException.java | 3 +-
.../exception/DropInUsedTablesException.java | 3 +-
.../exception/DuplicatedIndexException.java | 3 +-
.../EmptyShardingRouteResultException.java | 3 +-
.../sharding/exception/EngagedViewException.java | 3 +-
.../GenerateKeyStrategyNotFoundException.java | 3 +-
...InconsistentShardingTableMetaDataException.java | 3 +-
.../exception/IndexNotExistedException.java | 3 +-
.../InsertSelectTableViolationException.java | 3 +-
.../exception/InvalidDatetimeFormatException.java | 3 +-
...rdingAlgorithmExpressionAndColumnException.java | 3 +-
...GenerateKeyColumnWithInsertSelectException.java | 3 +-
.../exception/NullShardingValueException.java | 3 +-
.../RenamedViewWithoutSameConfigException.java | 3 +-
...rdingAlgorithmClassImplementationException.java | 3 +-
.../exception/ShardingDDLRouteException.java | 3 +-
.../exception/ShardingRouteAlgorithmException.java | 3 +-
.../exception/ShardingRuleNotFoundException.java | 3 +-
...lesException.java => ShardingSQLException.java} | 16 +++----
.../exception/ShardingValueDataTypeException.java | 3 +-
.../exception/UnsupportedCreateViewException.java | 3 +-
...ortedPrepareRouteToSameDataSourceException.java | 3 +-
.../UnsupportedShardingOperationException.java | 3 +-
.../UnsupportedUpdatingShardingValueException.java | 3 +-
.../external/sql/ShardingSphereSQLException.java | 8 ++--
.../sql/type/feature/FeatureSQLException.java | 10 ++++-
.../sql/type/generic/GenericSQLException.java | 6 ++-
.../sql/type/kernel/KernelSQLException.java | 6 ++-
.../sql/type/wrapper/SQLWrapperException.java | 4 +-
.../sql/type/feature/FeatureSQLExceptionTest.java | 49 ++++++++++++++++++++++
59 files changed, 172 insertions(+), 147 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index e906cd79ac5..9b405e7895a 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -19,7 +19,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY004 | 10006 | SQL String can not be NULL or empty |
| 08000 | 10007 | Can not get %d connections one time, partition succeed connection(%d) have released. Please consider increasing the \`maxPoolSize\` of the data sources or decreasing the \`max-connections-size-per-query\` in properties |
| HY004 | 10100 | Can not register driver, reason is: %s |
-| 34000 | 10200 | Can not get cursor name from fetch statement |
| HY000 | 10300 | Could not support variable \`%s\` |
| HY004 | 10301 | Invalid value \`%s\` |
| HV008 | 10302 | Column index \`%d\` is out of range |
@@ -81,6 +80,7 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY000 | 20050 | Routed target \`%s\` does not exist, available targets are \`%s\` |
| HY000 | 20051 | \`%s %s\` can not route correctly for %s \`%s\` |
| 42S02 | 20052 | Can not find data source in sharding rule, invalid actual data node \`%s\` |
+| 34000 | 20053 | Can not get cursor name from fetch statement |
| HY000 | 23000 | MGR plugin is not active in database \`%s\` |
| 44000 | 23001 | MGR is not in single primary mode in database \`%s\` |
| 44000 | 23002 | \`%s\` is not in MGR replication group member in database \`%s\` |
@@ -92,6 +92,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 44000 | 27004 | Can not find logic encrypt column by \`%s\` |
| 44000 | 27005 | Fail to find encrypt column \`%s\` from table \`%s\` |
| HY004 | 28000 | Shadow column \`%s\` of table \`%s\` does not support \`%s\` type |
-| 42000 | 28003 | Insert value of index \`%s\` can not support for shadow |
+| 42000 | 28001 | Insert value of index \`%s\` can not support for shadow |
| HY004 | 30000 | Unknown exception: %s |
| 0A000 | 30001 | Unsupported operation: %s |
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index d2ba26b3076..cded275a1c6 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -19,7 +19,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| HY004 | 10006 | SQL String can not be NULL or empty |
| 08000 | 10007 | Can not get %d connections one time, partition succeed connection(%d) have released. Please consider increasing the \`maxPoolSize\` of the data sources or decreasing the \`max-connections-size-per-query\` in properties |
| HY004 | 10100 | Can not register driver, reason is: %s |
-| 34000 | 10200 | Can not get cursor name from fetch statement |
| HY000 | 10300 | Could not support variable \`%s\` |
| HY004 | 10301 | Invalid value \`%s\` |
| HV008 | 10302 | Column index \`%d\` is out of range |
@@ -81,6 +80,7 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| HY000 | 20050 | Routed target \`%s\` does not exist, available targets are \`%s\` |
| HY000 | 20051 | \`%s %s\` can not route correctly for %s \`%s\` |
| 42S02 | 20052 | Can not find data source in sharding rule, invalid actual data node \`%s\` |
+| 34000 | 20053 | Can not get cursor name from fetch statement |
| HY000 | 23000 | MGR plugin is not active in database \`%s\` |
| 44000 | 23001 | MGR is not in single primary mode in database \`%s\` |
| 44000 | 23002 | \`%s\` is not in MGR replication group member in database \`%s\` |
@@ -92,6 +92,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| 44000 | 27004 | Can not find logic encrypt column by \`%s\` |
| 44000 | 27005 | Fail to find encrypt column \`%s\` from table \`%s\` |
| HY004 | 28000 | Shadow column \`%s\` of table \`%s\` does not support \`%s\` type |
-| 42000 | 28003 | Insert value of index \`%s\` can not support for shadow |
+| 42000 | 28001 | Insert value of index \`%s\` can not support for shadow |
| HY004 | 30000 | Unknown exception: %s |
| 0A000 | 30001 | Unsupported operation: %s |
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/DBDiscoverySQLException.java
similarity index 69%
copy from shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
copy to shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/DBDiscoverySQLException.java
index 11a0549fc53..b780aada773 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/DBDiscoverySQLException.java
@@ -17,17 +17,19 @@
package org.apache.shardingsphere.dbdiscovery.mysql.exception;
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.SQLState;
import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
-import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
- * Invalid MGR plugin exception.
+ * Database discovery SQL exception.
*/
-public final class InvalidMGRPluginException extends FeatureSQLException {
+public abstract class DBDiscoverySQLException extends FeatureSQLException {
- private static final long serialVersionUID = 1703082683321097037L;
+ private static final long serialVersionUID = 2693931450412858590L;
- public InvalidMGRPluginException(final String databaseName) {
- super(XOpenSQLState.GENERAL_ERROR, 3000, "MGR plugin is not active in database `%s`", databaseName);
+ private static final int FEATURE_CODE = 3;
+
+ public DBDiscoverySQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, FEATURE_CODE, vendorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
index 8b72fcdfcb1..e98519b439b 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.dbdiscovery.mysql.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Invalid MGR group name configuration exception.
*/
-public final class InvalidMGRGroupNameConfigurationException extends FeatureSQLException {
+public final class InvalidMGRGroupNameConfigurationException extends DBDiscoverySQLException {
private static final long serialVersionUID = -2585442998454509788L;
public InvalidMGRGroupNameConfigurationException(final String groupName, final String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 3003, "Group name in MGR is not same with configured one `%s` in database `%s`", groupName, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 3, "Group name in MGR is not same with configured one `%s` in database `%s`", groupName, databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
index 5e0222b945d..e8255b37aad 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.dbdiscovery.mysql.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Invalid MGR mode exception.
*/
-public final class InvalidMGRModeException extends FeatureSQLException {
+public final class InvalidMGRModeException extends DBDiscoverySQLException {
private static final long serialVersionUID = -2190741601319220590L;
public InvalidMGRModeException(final String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 3001, "MGR is not in single primary mode in database `%s`", databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 1, "MGR is not in single primary mode in database `%s`", databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
index 11a0549fc53..8e8810b3440 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.dbdiscovery.mysql.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Invalid MGR plugin exception.
*/
-public final class InvalidMGRPluginException extends FeatureSQLException {
+public final class InvalidMGRPluginException extends DBDiscoverySQLException {
private static final long serialVersionUID = 1703082683321097037L;
public InvalidMGRPluginException(final String databaseName) {
- super(XOpenSQLState.GENERAL_ERROR, 3000, "MGR plugin is not active in database `%s`", databaseName);
+ super(XOpenSQLState.GENERAL_ERROR, 0, "MGR plugin is not active in database `%s`", databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
index 8de48022113..38a5bcaf216 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.dbdiscovery.mysql.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Invalid MGR replication group member exception.
*/
-public final class InvalidMGRReplicationGroupMemberException extends FeatureSQLException {
+public final class InvalidMGRReplicationGroupMemberException extends DBDiscoverySQLException {
private static final long serialVersionUID = 3766206496827463146L;
public InvalidMGRReplicationGroupMemberException(final String url, final String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 3002, "`%s` is not in MGR replication group member in database `%s`", url, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 2, "`%s` is not in MGR replication group member in database `%s`", url, databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptAlgorithmInitializationException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptAlgorithmInitializationException.java
index 3cea5d2678e..8669752f576 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptAlgorithmInitializationException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptAlgorithmInitializationException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Encrypt algorithm initialization exception.
*/
-public final class EncryptAlgorithmInitializationException extends FeatureSQLException {
+public final class EncryptAlgorithmInitializationException extends EncryptSQLException {
private static final long serialVersionUID = -2004166948563207100L;
public EncryptAlgorithmInitializationException(final String encryptorType, final String reason) {
- super(XOpenSQLState.GENERAL_ERROR, 7000, "Encrypt algorithm `%s` initialization failed, reason is: %s", encryptorType, reason);
+ super(XOpenSQLState.GENERAL_ERROR, 0, "Encrypt algorithm `%s` initialization failed, reason is: %s", encryptorType, reason);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnAlterException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnAlterException.java
index 6389d899cbf..81418b9b542 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnAlterException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnAlterException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Encrypt column alter exception.
*/
-public final class EncryptColumnAlterException extends FeatureSQLException {
+public final class EncryptColumnAlterException extends EncryptSQLException {
private static final long serialVersionUID = -8920381230872401155L;
public EncryptColumnAlterException(final String table, final String alteredColumn, final String previousColumn) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 7002, "Altered column `%s` must use same encrypt algorithm with previous column `%s` in table `%s`", alteredColumn, previousColumn, table);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 2, "Altered column `%s` must use same encrypt algorithm with previous column `%s` in table `%s`", alteredColumn, previousColumn, table);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnNotFoundException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnNotFoundException.java
index 32d771a34ea..431eed572bc 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptColumnNotFoundException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Encrypt column not found exception.
*/
-public final class EncryptColumnNotFoundException extends FeatureSQLException {
+public final class EncryptColumnNotFoundException extends EncryptSQLException {
private static final long serialVersionUID = -8481487069938556675L;
public EncryptColumnNotFoundException(final String tableName, final String columnName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 7005, "Fail to find encrypt column `%s` from table `%s`", columnName, tableName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 5, "Fail to find encrypt column `%s` from table `%s`", columnName, tableName);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptLogicColumnNotFoundException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptLogicColumnNotFoundException.java
index 06f99aade55..40ea310c2fb 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptLogicColumnNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptLogicColumnNotFoundException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Encrypt logic column not found exception.
*/
-public final class EncryptLogicColumnNotFoundException extends FeatureSQLException {
+public final class EncryptLogicColumnNotFoundException extends EncryptSQLException {
private static final long serialVersionUID = 3934531389314348880L;
public EncryptLogicColumnNotFoundException(final String actualColumn) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 7004, "Can not find logic encrypt column by `%s`", actualColumn);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 4, "Can not find logic encrypt column by `%s`", actualColumn);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptSQLException.java
similarity index 69%
copy from shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java
copy to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptSQLException.java
index df6f90742ab..9ee0b562923 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/EncryptSQLException.java
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.exception.external.sql.type.feature;
+package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.SQLState;
+import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
/**
- * Feature SQL exception.
+ * Encrypt SQL exception.
*/
-public abstract class FeatureSQLException extends ShardingSphereSQLException {
+public abstract class EncryptSQLException extends FeatureSQLException {
- private static final long serialVersionUID = -3748977692432149265L;
+ private static final long serialVersionUID = -8616403083235617682L;
- public FeatureSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
- super(sqlState, 2, vendorCode, reason, messageArguments);
+ private static final int FEATURE_CODE = 7;
+
+ public EncryptSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, FEATURE_CODE, vendorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptInsertValueException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptInsertValueException.java
index 7d05f07d80f..008b3e82b64 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptInsertValueException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptInsertValueException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported encrypt insert value exception.
*/
-public final class UnsupportedEncryptInsertValueException extends FeatureSQLException {
+public final class UnsupportedEncryptInsertValueException extends EncryptSQLException {
private static final long serialVersionUID = 5004882561157380582L;
public UnsupportedEncryptInsertValueException(final int columnIndex) {
- super(XOpenSQLState.SYNTAX_ERROR, 7003, "Insert value of index `%s` can not support for encrypt", String.valueOf(columnIndex));
+ super(XOpenSQLState.SYNTAX_ERROR, 3, "Insert value of index `%s` can not support for encrypt", String.valueOf(columnIndex));
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptSQLException.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptSQLException.java
index a4aa3016f9a..c41e0c27dd9 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptSQLException.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/exception/UnsupportedEncryptSQLException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.encrypt.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported encrypt SQL exception.
*/
-public final class UnsupportedEncryptSQLException extends FeatureSQLException {
+public final class UnsupportedEncryptSQLException extends EncryptSQLException {
private static final long serialVersionUID = 8391663664617661217L;
public UnsupportedEncryptSQLException(final String sqlClause) {
- super(XOpenSQLState.SYNTAX_ERROR, 7001, "The SQL clause `%s` is unsupported in encrypt rule", sqlClause);
+ super(XOpenSQLState.SYNTAX_ERROR, 1, "The SQL clause `%s` is unsupported in encrypt rule", sqlClause);
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
index 306a2549fc6..0ac34276834 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.shadow.algorithm.shadow.validator;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.shadow.algorithm.shadow.UnsupportedShadowColumnTypeException;
+import org.apache.shardingsphere.shadow.exception.UnsupportedShadowColumnTypeException;
import java.util.Date;
import java.util.HashSet;
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/ShadowSQLException.java
similarity index 70%
copy from shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java
copy to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/ShadowSQLException.java
index 1e89e269540..731be30f0ff 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/ShadowSQLException.java
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.exception.external.sql.type.kernel;
+package org.apache.shardingsphere.shadow.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.SQLState;
+import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
/**
- * Kernel SQL exception.
+ * Shadow SQL exception.
*/
-public abstract class KernelSQLException extends ShardingSphereSQLException {
+public abstract class ShadowSQLException extends FeatureSQLException {
- private static final long serialVersionUID = -6554922589499988153L;
+ private static final long serialVersionUID = 2516457164731028332L;
- public KernelSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
- super(sqlState, 1, vendorCode, reason, messageArguments);
+ private static final int FEATURE_CODE = 8;
+
+ public ShadowSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, FEATURE_CODE, vendorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowColumnTypeException.java
similarity index 78%
rename from shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowColumnTypeException.java
index f57e8e68a33..75291cca467 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/UnsupportedShadowColumnTypeException.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowColumnTypeException.java
@@ -15,19 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.algorithm.shadow;
+package org.apache.shardingsphere.shadow.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported shadow column type exception.
*/
-public final class UnsupportedShadowColumnTypeException extends FeatureSQLException {
+public final class UnsupportedShadowColumnTypeException extends ShadowSQLException {
private static final long serialVersionUID = 8144277065388645946L;
public UnsupportedShadowColumnTypeException(final String tableName, final String columnName, final Class<?> type) {
- super(XOpenSQLState.INVALID_DATA_TYPE, 8000, "Shadow column `%s` of table `%s` does not support `%s` type", columnName, tableName, type.getName());
+ super(XOpenSQLState.INVALID_DATA_TYPE, 0, "Shadow column `%s` of table `%s` does not support `%s` type", columnName, tableName, type.getName());
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/exception/UnsupportedShadowInsertValueException.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowInsertValueException.java
similarity index 78%
rename from shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/exception/UnsupportedShadowInsertValueException.java
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowInsertValueException.java
index 80e22fc9752..faccb9e922b 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/exception/UnsupportedShadowInsertValueException.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/exception/UnsupportedShadowInsertValueException.java
@@ -15,19 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.route.exception;
+package org.apache.shardingsphere.shadow.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported shadow insert value exception.
*/
-public final class UnsupportedShadowInsertValueException extends FeatureSQLException {
+public final class UnsupportedShadowInsertValueException extends ShadowSQLException {
private static final long serialVersionUID = -5987403907441367171L;
public UnsupportedShadowInsertValueException(final int columnIndex) {
- super(XOpenSQLState.SYNTAX_ERROR, 8003, "Insert value of index `%s` can not support for shadow", String.valueOf(columnIndex));
+ super(XOpenSQLState.SYNTAX_ERROR, 1, "Insert value of index `%s` can not support for shadow", String.valueOf(columnIndex));
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/engine/dml/ShadowInsertStatementRoutingEngine.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/engine/dml/ShadowInsertStatementRoutingEngine.java
index 655497c0069..343f9868903 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/engine/dml/ShadowInsertStatementRoutingEngine.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/engine/dml/ShadowInsertStatementRoutingEngine.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.binder.segment.insert.values.InsertValueC
import org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
import org.apache.shardingsphere.shadow.api.shadow.ShadowOperationType;
import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
-import org.apache.shardingsphere.shadow.route.exception.UnsupportedShadowInsertValueException;
+import org.apache.shardingsphere.shadow.exception.UnsupportedShadowInsertValueException;
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
import java.util.Collection;
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
index 6aaf6dab2b6..583a0500a53 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.shadow.algorithm.shadow.UnsupportedShadowColumnTypeException;
+import org.apache.shardingsphere.shadow.exception.UnsupportedShadowColumnTypeException;
import org.apache.shardingsphere.shadow.factory.ShadowAlgorithmFactory;
import org.junit.Test;
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
index 7be6a933aa8..692d06a8de7 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.shadow.algorithm.shadow.UnsupportedShadowColumnTypeException;
+import org.apache.shardingsphere.shadow.exception.UnsupportedShadowColumnTypeException;
import org.apache.shardingsphere.shadow.factory.ShadowAlgorithmFactory;
import org.junit.Test;
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidatorTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidatorTest.java
index 621cf1d7cf9..2014f60602b 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidatorTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidatorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.validator;
-import org.apache.shardingsphere.shadow.algorithm.shadow.UnsupportedShadowColumnTypeException;
+import org.apache.shardingsphere.shadow.exception.UnsupportedShadowColumnTypeException;
import org.junit.Test;
import java.util.Date;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualDataNodesMissedWithShardingTableException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualDataNodesMissedWithShardingTableException.java
index 2f8b42f57cb..568f8fd3271 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualDataNodesMissedWithShardingTableException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualDataNodesMissedWithShardingTableException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Actual data nodes missed with sharding table exception.
*/
-public final class ActualDataNodesMissedWithShardingTableException extends FeatureSQLException {
+public final class ActualDataNodesMissedWithShardingTableException extends ShardingSQLException {
private static final long serialVersionUID = 1691113459377955727L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualTableNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualTableNotFoundException.java
index be23a518539..6b31bec752a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualTableNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ActualTableNotFoundException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Actual table not found exception.
*/
-public final class ActualTableNotFoundException extends FeatureSQLException {
+public final class ActualTableNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = -5008645813201488531L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/BindingTableNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/BindingTableNotFoundException.java
index fdef395a74f..f07c55818a1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/BindingTableNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/BindingTableNotFoundException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Binding table not found exception.
*/
-public final class BindingTableNotFoundException extends FeatureSQLException {
+public final class BindingTableNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = -8845309665057958820L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/CursorNameNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/CursorNameNotFoundException.java
index 3ae698ab9e3..97771d926a3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/CursorNameNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/CursorNameNotFoundException.java
@@ -17,17 +17,16 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.kernel.KernelSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Cursor name not found exception.
*/
-public final class CursorNameNotFoundException extends KernelSQLException {
+public final class CursorNameNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = 3124329832945598311L;
public CursorNameNotFoundException() {
- super(XOpenSQLState.INVALID_CURSOR_NAME, 200, "Can not get cursor name from fetch statement");
+ super(XOpenSQLState.INVALID_CURSOR_NAME, 53, "Can not get cursor name from fetch statement");
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLMultipleDataNodesWithLimitException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLMultipleDataNodesWithLimitException.java
index fbcda2436ca..f01bfd5337a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLMultipleDataNodesWithLimitException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLMultipleDataNodesWithLimitException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* DML multiple data nodes with limit Exception.
*/
-public final class DMLMultipleDataNodesWithLimitException extends FeatureSQLException {
+public final class DMLMultipleDataNodesWithLimitException extends ShardingSQLException {
private static final long serialVersionUID = -203240151021113065L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLWithMultipleShardingTablesException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLWithMultipleShardingTablesException.java
index 6ac7983294a..b317c6d228b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLWithMultipleShardingTablesException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DMLWithMultipleShardingTablesException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* DML with multiple sharding tables exception.
*/
-public final class DMLWithMultipleShardingTablesException extends FeatureSQLException {
+public final class DMLWithMultipleShardingTablesException extends ShardingSQLException {
private static final long serialVersionUID = -7368310216924145478L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataNodeGenerateException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataNodeGenerateException.java
index cb0edcccb8c..7d92f99decf 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataNodeGenerateException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataNodeGenerateException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Data node generate exception.
*/
-public final class DataNodeGenerateException extends FeatureSQLException {
+public final class DataNodeGenerateException extends ShardingSQLException {
private static final long serialVersionUID = -1000865538051567910L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataSourceIntersectionNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataSourceIntersectionNotFoundException.java
index 61c0211b881..897093b2d84 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataSourceIntersectionNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DataSourceIntersectionNotFoundException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* Data source intersection not found exception.
*/
-public final class DataSourceIntersectionNotFoundException extends FeatureSQLException {
+public final class DataSourceIntersectionNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = -2142571707728236489L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java
index 62d60a9f4b0..a19ce953121 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* Drop in used tables exception.
*/
-public final class DropInUsedTablesException extends FeatureSQLException {
+public final class DropInUsedTablesException extends ShardingSQLException {
private static final long serialVersionUID = 8939233348292246498L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DuplicatedIndexException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DuplicatedIndexException.java
index ea52786f378..9dc8c9882b0 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DuplicatedIndexException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DuplicatedIndexException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Duplicated index exception.
*/
-public final class DuplicatedIndexException extends FeatureSQLException {
+public final class DuplicatedIndexException extends ShardingSQLException {
private static final long serialVersionUID = 2884666477007627873L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EmptyShardingRouteResultException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EmptyShardingRouteResultException.java
index a0fd8b85dae..a7f3f35ed69 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EmptyShardingRouteResultException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EmptyShardingRouteResultException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Empty sharding route result exception.
*/
-public final class EmptyShardingRouteResultException extends FeatureSQLException {
+public final class EmptyShardingRouteResultException extends ShardingSQLException {
private static final long serialVersionUID = -6548076668933945656L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EngagedViewException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EngagedViewException.java
index ec37d63ef6b..8749d93ae32 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EngagedViewException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/EngagedViewException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Engaged view exception.
*/
-public final class EngagedViewException extends FeatureSQLException {
+public final class EngagedViewException extends ShardingSQLException {
private static final long serialVersionUID = -8312969473716234951L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/GenerateKeyStrategyNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/GenerateKeyStrategyNotFoundException.java
index 4c8c9a1fca4..5e1919ddd92 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/GenerateKeyStrategyNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/GenerateKeyStrategyNotFoundException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Generate key strategy not found exception.
*/
-public final class GenerateKeyStrategyNotFoundException extends FeatureSQLException {
+public final class GenerateKeyStrategyNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = 7456922260524630374L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InconsistentShardingTableMetaDataException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InconsistentShardingTableMetaDataException.java
index c4bc3763571..7991934db44 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InconsistentShardingTableMetaDataException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InconsistentShardingTableMetaDataException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import org.apache.shardingsphere.sharding.metadata.TableMetaDataViolation;
@@ -26,7 +25,7 @@ import java.util.Collection;
/**
* Inconsistent sharding table meta data exception.
*/
-public final class InconsistentShardingTableMetaDataException extends FeatureSQLException {
+public final class InconsistentShardingTableMetaDataException extends ShardingSQLException {
private static final long serialVersionUID = -5450346946223396192L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/IndexNotExistedException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/IndexNotExistedException.java
index 065e01d7891..5bcd60587b4 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/IndexNotExistedException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/IndexNotExistedException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Index not existed exception.
*/
-public final class IndexNotExistedException extends FeatureSQLException {
+public final class IndexNotExistedException extends ShardingSQLException {
private static final long serialVersionUID = 206503570677185269L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InsertSelectTableViolationException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InsertSelectTableViolationException.java
index 996552f866d..53ea22f7496 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InsertSelectTableViolationException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InsertSelectTableViolationException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Insert select table violation exception.
*/
-public final class InsertSelectTableViolationException extends FeatureSQLException {
+public final class InsertSelectTableViolationException extends ShardingSQLException {
private static final long serialVersionUID = 1221612068163533037L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InvalidDatetimeFormatException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InvalidDatetimeFormatException.java
index e0e26b5e007..659dea92a1a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InvalidDatetimeFormatException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/InvalidDatetimeFormatException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Invalid datetime format exception.
*/
-public final class InvalidDatetimeFormatException extends FeatureSQLException {
+public final class InvalidDatetimeFormatException extends ShardingSQLException {
private static final long serialVersionUID = 4472952142748467059L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MismatchedInlineShardingAlgorithmExpressionAndColumnException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MismatchedInlineShardingAlgorithmExpressionAndColumnException.java
index 4c6fb18be8b..1706560e890 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MismatchedInlineShardingAlgorithmExpressionAndColumnException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MismatchedInlineShardingAlgorithmExpressionAndColumnException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Mismatched inline sharding algorithm's expression and column exception.
*/
-public final class MismatchedInlineShardingAlgorithmExpressionAndColumnException extends FeatureSQLException {
+public final class MismatchedInlineShardingAlgorithmExpressionAndColumnException extends ShardingSQLException {
private static final long serialVersionUID = 1306301016127278233L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MissingGenerateKeyColumnWithInsertSelectException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MissingGenerateKeyColumnWithInsertSelectException.java
index 3f15d8cf134..0bc24fee231 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MissingGenerateKeyColumnWithInsertSelectException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/MissingGenerateKeyColumnWithInsertSelectException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Missing generate key column with insert select exception.
*/
-public final class MissingGenerateKeyColumnWithInsertSelectException extends FeatureSQLException {
+public final class MissingGenerateKeyColumnWithInsertSelectException extends ShardingSQLException {
private static final long serialVersionUID = 568269722599010228L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/NullShardingValueException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/NullShardingValueException.java
index 7888e485a60..a58410dd0af 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/NullShardingValueException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/NullShardingValueException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Null sharding value exception.
*/
-public final class NullShardingValueException extends FeatureSQLException {
+public final class NullShardingValueException extends ShardingSQLException {
private static final long serialVersionUID = -6223086772479822057L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/RenamedViewWithoutSameConfigException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/RenamedViewWithoutSameConfigException.java
index c11029b0e90..9696c8a7e37 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/RenamedViewWithoutSameConfigException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/RenamedViewWithoutSameConfigException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported rename view exception.
*/
-public final class RenamedViewWithoutSameConfigException extends FeatureSQLException {
+public final class RenamedViewWithoutSameConfigException extends ShardingSQLException {
private static final long serialVersionUID = -8276278970848162458L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingAlgorithmClassImplementationException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingAlgorithmClassImplementationException.java
index ee724174e88..f7b4dae9d08 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingAlgorithmClassImplementationException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingAlgorithmClassImplementationException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Sharding algorithm class implementation exception.
*/
-public final class ShardingAlgorithmClassImplementationException extends FeatureSQLException {
+public final class ShardingAlgorithmClassImplementationException extends ShardingSQLException {
private static final long serialVersionUID = 3053033454701332815L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingDDLRouteException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingDDLRouteException.java
index c3bfd1544ce..29d45222a07 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingDDLRouteException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingDDLRouteException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* Sharding DDL route exception.
*/
-public final class ShardingDDLRouteException extends FeatureSQLException {
+public final class ShardingDDLRouteException extends ShardingSQLException {
private static final long serialVersionUID = 1611718269096645289L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRouteAlgorithmException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRouteAlgorithmException.java
index f3d8d5df3cc..3ef4247c06f 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRouteAlgorithmException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRouteAlgorithmException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* Sharding route algorithm exception.
*/
-public final class ShardingRouteAlgorithmException extends FeatureSQLException {
+public final class ShardingRouteAlgorithmException extends ShardingSQLException {
private static final long serialVersionUID = -1935526748399934543L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRuleNotFoundException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRuleNotFoundException.java
index 37af5877e84..98d98115a18 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRuleNotFoundException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingRuleNotFoundException.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import java.util.Collection;
@@ -25,7 +24,7 @@ import java.util.Collection;
/**
* Sharding rule not found exception.
*/
-public final class ShardingRuleNotFoundException extends FeatureSQLException {
+public final class ShardingRuleNotFoundException extends ShardingSQLException {
private static final long serialVersionUID = 142299282103233064L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingSQLException.java
similarity index 69%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java
copy to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingSQLException.java
index 62d60a9f4b0..9ab5e199c0b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/DropInUsedTablesException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingSQLException.java
@@ -17,19 +17,19 @@
package org.apache.shardingsphere.sharding.exception;
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.SQLState;
import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
-import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
-
-import java.util.Collection;
/**
- * Drop in used tables exception.
+ * Sharding SQL exception.
*/
-public final class DropInUsedTablesException extends FeatureSQLException {
+public abstract class ShardingSQLException extends FeatureSQLException {
+
+ private static final long serialVersionUID = 3711541889264606386L;
- private static final long serialVersionUID = 8939233348292246498L;
+ private static final int FEATURE_CODE = 0;
- public DropInUsedTablesException(final Collection<String> inUsedTables) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 32, "Actual tables `%s` are in use", inUsedTables.toString());
+ public ShardingSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, FEATURE_CODE, vendorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingValueDataTypeException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingValueDataTypeException.java
index 2f0dde4f341..301aa00aee3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingValueDataTypeException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/ShardingValueDataTypeException.java
@@ -17,14 +17,13 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
import org.apache.shardingsphere.sharding.route.engine.condition.Column;
/**
* Sharding value data type exception.
*/
-public final class ShardingValueDataTypeException extends FeatureSQLException {
+public final class ShardingValueDataTypeException extends ShardingSQLException {
private static final long serialVersionUID = -4833106947304679015L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedCreateViewException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedCreateViewException.java
index 9ee3fb12f0d..20b245ceb68 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedCreateViewException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedCreateViewException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported create view exception.
*/
-public final class UnsupportedCreateViewException extends FeatureSQLException {
+public final class UnsupportedCreateViewException extends ShardingSQLException {
private static final long serialVersionUID = -321126834428609310L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedPrepareRouteToSameDataSourceException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedPrepareRouteToSameDataSourceException.java
index f51131e5baf..dd6e0c597b9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedPrepareRouteToSameDataSourceException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedPrepareRouteToSameDataSourceException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported prepare route to same data source exception.
*/
-public final class UnsupportedPrepareRouteToSameDataSourceException extends FeatureSQLException {
+public final class UnsupportedPrepareRouteToSameDataSourceException extends ShardingSQLException {
private static final long serialVersionUID = -451667286925533523L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedShardingOperationException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedShardingOperationException.java
index fc2a525bee1..220f6d9d0b9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedShardingOperationException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedShardingOperationException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported sharding operation exception.
*/
-public final class UnsupportedShardingOperationException extends FeatureSQLException {
+public final class UnsupportedShardingOperationException extends ShardingSQLException {
private static final long serialVersionUID = 1009938372927671322L;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedUpdatingShardingValueException.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedUpdatingShardingValueException.java
index 5655c9a8239..35dd81d4a08 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedUpdatingShardingValueException.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/exception/UnsupportedUpdatingShardingValueException.java
@@ -17,13 +17,12 @@
package org.apache.shardingsphere.sharding.exception;
-import org.apache.shardingsphere.infra.util.exception.external.sql.type.feature.FeatureSQLException;
import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
* Unsupported updating sharding value exception.
*/
-public final class UnsupportedUpdatingShardingValueException extends FeatureSQLException {
+public final class UnsupportedUpdatingShardingValueException extends ShardingSQLException {
private static final long serialVersionUID = 2552228890146113383L;
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/ShardingSphereSQLException.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/ShardingSphereSQLException.java
index 42904c2ebb2..76c412c2224 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/ShardingSphereSQLException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/ShardingSphereSQLException.java
@@ -35,13 +35,13 @@ public abstract class ShardingSphereSQLException extends ShardingSphereExternalE
private final String reason;
- public ShardingSphereSQLException(final SQLState sqlState, final int typeOffset, final int vendorCode, final String reason, final Object... messageArguments) {
- this(sqlState.getValue(), typeOffset, vendorCode, reason, messageArguments);
+ public ShardingSphereSQLException(final SQLState sqlState, final int typeOffset, final int errorCode, final String reason, final Object... messageArguments) {
+ this(sqlState.getValue(), typeOffset, errorCode, reason, messageArguments);
}
- public ShardingSphereSQLException(final String sqlState, final int typeOffset, final int vendorCode, final String reason, final Object... messageArguments) {
+ public ShardingSphereSQLException(final String sqlState, final int typeOffset, final int errorCode, final String reason, final Object... messageArguments) {
this.sqlState = sqlState;
- this.vendorCode = typeOffset * 10000 + vendorCode;
+ vendorCode = typeOffset * 10000 + errorCode;
this.reason = null == reason ? null : String.format(reason, messageArguments);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java
index df6f90742ab..1fc412c1413 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLException.java
@@ -27,7 +27,13 @@ public abstract class FeatureSQLException extends ShardingSphereSQLException {
private static final long serialVersionUID = -3748977692432149265L;
- public FeatureSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
- super(sqlState, 2, vendorCode, reason, messageArguments);
+ private static final int TYPE_OFFSET = 2;
+
+ public FeatureSQLException(final SQLState sqlState, final int featureCode, final int errorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, TYPE_OFFSET, generateErrorCode(featureCode, errorCode), reason, messageArguments);
+ }
+
+ private static int generateErrorCode(final int featureCode, final int errorCode) {
+ return (featureCode < 10 ? featureCode * 1000 : featureCode * 100) + errorCode;
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/generic/GenericSQLException.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/generic/GenericSQLException.java
index 418ec726d55..a2af72f6553 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/generic/GenericSQLException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/generic/GenericSQLException.java
@@ -27,7 +27,9 @@ public abstract class GenericSQLException extends ShardingSphereSQLException {
private static final long serialVersionUID = 1156879276497567865L;
- public GenericSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
- super(sqlState, 3, vendorCode, reason, messageArguments);
+ private static final int TYPE_OFFSET = 3;
+
+ public GenericSQLException(final SQLState sqlState, final int errorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, TYPE_OFFSET, errorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java
index 1e89e269540..8dd25395f1f 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/kernel/KernelSQLException.java
@@ -27,7 +27,9 @@ public abstract class KernelSQLException extends ShardingSphereSQLException {
private static final long serialVersionUID = -6554922589499988153L;
- public KernelSQLException(final SQLState sqlState, final int vendorCode, final String reason, final Object... messageArguments) {
- super(sqlState, 1, vendorCode, reason, messageArguments);
+ private static final int TYPE_OFFSET = 1;
+
+ public KernelSQLException(final SQLState sqlState, final int errorCode, final String reason, final Object... messageArguments) {
+ super(sqlState, TYPE_OFFSET, errorCode, reason, messageArguments);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/wrapper/SQLWrapperException.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/wrapper/SQLWrapperException.java
index 3731ce0659b..d8465532972 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/wrapper/SQLWrapperException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/wrapper/SQLWrapperException.java
@@ -28,7 +28,9 @@ public final class SQLWrapperException extends ShardingSphereSQLException {
private static final long serialVersionUID = 8983736995662464009L;
+ private static final int TYPE_OFFSET = 0;
+
public SQLWrapperException(final SQLException cause) {
- super(cause.getSQLState(), 0, cause.getErrorCode(), cause.getMessage());
+ super(cause.getSQLState(), TYPE_OFFSET, cause.getErrorCode(), cause.getMessage());
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLExceptionTest.java b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLExceptionTest.java
new file mode 100644
index 00000000000..806566394a4
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/exception/external/sql/type/feature/FeatureSQLExceptionTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.util.exception.external.sql.type.feature;
+
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+import org.junit.Test;
+
+import java.sql.SQLException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class FeatureSQLExceptionTest {
+
+ @SuppressWarnings("serial")
+ @Test
+ public void assertNewFeatureSQLExceptionWithSingleDigitalForFeatureCode() {
+ SQLException actual = new FeatureSQLException(XOpenSQLState.GENERAL_ERROR, 1, 1, "reason") {
+ }.toSQLException();
+ assertThat(actual.getSQLState(), is(XOpenSQLState.GENERAL_ERROR.getValue()));
+ assertThat(actual.getErrorCode(), is(21001));
+ assertThat(actual.getMessage(), is("reason"));
+ }
+
+ @SuppressWarnings("serial")
+ @Test
+ public void assertNewFeatureSQLExceptionWithDoubleDigitalForFeatureCode() {
+ SQLException actual = new FeatureSQLException(XOpenSQLState.GENERAL_ERROR, 99, 10, "reason") {
+ }.toSQLException();
+ assertThat(actual.getSQLState(), is(XOpenSQLState.GENERAL_ERROR.getValue()));
+ assertThat(actual.getErrorCode(), is(29910));
+ assertThat(actual.getMessage(), is("reason"));
+ }
+}