This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 d1a45649e89 Refactor DataSQLException (#30736)
d1a45649e89 is described below
commit d1a45649e899f63ade5c667401941cf2ec74a437
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Apr 1 22:41:45 2024 +0800
Refactor DataSQLException (#30736)
---
.../document/content/user-manual/error-code/sql-error-code.cn.md | 9 ++++-----
.../document/content/user-manual/error-code/sql-error-code.en.md | 9 ++++-----
.../exception/data}/UnsupportedDataTypeConversionException.java | 4 ++--
.../data}/UnsupportedStreamCharsetConversionException.java | 4 ++--
.../impl/driver/jdbc/type/stream/JDBCStreamQueryResult.java | 4 ++--
.../result/query/impl/driver/jdbc/type/util/ResultSetUtils.java | 2 +-
.../query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java | 2 +-
7 files changed, 16 insertions(+), 18 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 bf5deffa481..3d812d07acf 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
@@ -46,11 +46,10 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
### 数据
-| SQL State | Vendor Code | 错误信息
|
-|-----------|-------------|-----------------------------------------------------------|
-| HY004 | 11000 | Invalid value \`%s\`.
|
-| HY004 | 11001 | Unsupported conversion data type \`%s\` for value
\`%s\`. |
-| HY004 | 11010 | Unsupported conversion stream charset \`%s\`.
|
+| SQL State | Vendor Code | 错误信息
|
+|-----------|-------------|-------------------------------------------------------|
+| HY004 | 11000 | Unsupported conversion data type '%s' for value
'%s'. |
+| HY004 | 11001 | Unsupported conversion stream charset '%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 aee0ba3f88d..1a830aefc6f 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
@@ -46,11 +46,10 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
### Data
-| SQL State | Vendor Code | Reason
|
-|-----------|-------------|-----------------------------------------------------------|
-| HY004 | 11000 | Invalid value \`%s\`.
|
-| HY004 | 11001 | Unsupported conversion data type \`%s\` for value
\`%s\`. |
-| HY004 | 11010 | Unsupported conversion stream charset \`%s\`.
|
+| SQL State | Vendor Code | Reason
|
+|-----------|-------------|-------------------------------------------------------|
+| HY004 | 11000 | Unsupported conversion data type '%s' for value
'%s'. |
+| HY004 | 11001 | Unsupported conversion stream charset '%s'.
|
### Syntax
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedDataTypeConversionException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedDataTypeConversionException.java
similarity index 88%
rename from
infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedDataTypeConversionException.java
rename to
infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedDataTypeConversionException.java
index 34b368d095b..2a0e278ef96 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedDataTypeConversionException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedDataTypeConversionException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.executor.exception;
+package org.apache.shardingsphere.infra.exception.data;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.DataSQLException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
@@ -30,6 +30,6 @@ public final class UnsupportedDataTypeConversionException
extends DataSQLExcepti
private static final long serialVersionUID = 4808672149254705863L;
public UnsupportedDataTypeConversionException(final Class<?> convertType,
final Object value) {
- super(XOpenSQLState.INVALID_DATA_TYPE, 1, "Unsupported conversion data
type `%s` for value `%s`.", convertType.getName(), Objects.toString(value));
+ super(XOpenSQLState.INVALID_DATA_TYPE, 0, "Unsupported conversion data
type '%s' for value '%s'.", convertType.getName(), Objects.toString(value));
}
}
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedStreamCharsetConversionException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedStreamCharsetConversionException.java
similarity index 88%
rename from
infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedStreamCharsetConversionException.java
rename to
infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedStreamCharsetConversionException.java
index a693cb78043..9a4e86904ba 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/exception/UnsupportedStreamCharsetConversionException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/data/UnsupportedStreamCharsetConversionException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.executor.exception;
+package org.apache.shardingsphere.infra.exception.data;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.DataSQLException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
@@ -28,6 +28,6 @@ public final class
UnsupportedStreamCharsetConversionException extends DataSQLEx
private static final long serialVersionUID = 4577091201937095156L;
public UnsupportedStreamCharsetConversionException(final String
charsetType) {
- super(XOpenSQLState.INVALID_DATA_TYPE, 10, "Unsupported conversion
stream charset `%s`.", charsetType);
+ super(XOpenSQLState.INVALID_DATA_TYPE, 1, "Unsupported conversion
stream charset '%s'.", charsetType);
}
}
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/stream/JDBCStreamQueryResult.java
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/stream/JDBCStreamQueryResult.java
index bcfaba882b1..f0a27c57a09 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/stream/JDBCStreamQueryResult.java
+++
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/stream/JDBCStreamQueryResult.java
@@ -18,8 +18,8 @@
package
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream;
import lombok.Getter;
-import
org.apache.shardingsphere.infra.executor.exception.UnsupportedDataTypeConversionException;
-import
org.apache.shardingsphere.infra.executor.exception.UnsupportedStreamCharsetConversionException;
+import
org.apache.shardingsphere.infra.exception.data.UnsupportedDataTypeConversionException;
+import
org.apache.shardingsphere.infra.exception.data.UnsupportedStreamCharsetConversionException;
import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.metadata.JDBCQueryResultMetaData;
import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.type.stream.AbstractStreamQueryResult;
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
index 9d53ffa0d8e..93d7b5634c3 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
+++
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
@@ -22,7 +22,7 @@ import com.google.common.primitives.Longs;
import com.google.common.primitives.Shorts;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.infra.executor.exception.UnsupportedDataTypeConversionException;
+import
org.apache.shardingsphere.infra.exception.data.UnsupportedDataTypeConversionException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.math.BigDecimal;
diff --git
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
index e50898caceb..2cd711e8d33 100644
---
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
+++
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
@@ -21,7 +21,7 @@ import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;
import com.google.common.primitives.Shorts;
import lombok.SneakyThrows;
-import
org.apache.shardingsphere.infra.executor.exception.UnsupportedDataTypeConversionException;
+import
org.apache.shardingsphere.infra.exception.data.UnsupportedDataTypeConversionException;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;