This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 2f3a4d2  change the sqlState len (#9810)
2f3a4d2 is described below

commit 2f3a4d28a64b36de3577163b22eaa63cc2ee8199
Author: totalo <[email protected]>
AuthorDate: Thu Mar 25 17:12:26 2021 +0800

    change the sqlState len (#9810)
    
    * fixed 8179
---
 .../db/protocol/error/CommonErrorCode.java         | 30 +++++++++++-----------
 .../db/protocol/error/CommonErrorCodeTest.java     | 20 +++++++--------
 .../frontend/mysql/MySQLErrPacketFactoryTest.java  | 20 +++++++--------
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
index a0c5aa2..675e4f2 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
@@ -27,35 +27,35 @@ import lombok.RequiredArgsConstructor;
 @Getter
 public enum CommonErrorCode implements SQLErrorCode {
     
-    CIRCUIT_BREAK_MODE(10000, "C10000", "Circuit break mode is ON."),
+    CIRCUIT_BREAK_MODE(1000, "C1000", "Circuit break mode is ON."),
     
-    SHARDING_TABLE_RULES_NOT_EXISTED(11001, "C11001", "Sharding table rule %s 
is not exist."),
+    SHARDING_TABLE_RULES_NOT_EXISTED(1101, "C1101", "Sharding table rule %s is 
not exist."),
     
-    TABLES_IN_USED(11002, "C11002", "Can not drop rule, tables %s in the rule 
are still in used."),
+    TABLES_IN_USED(1102, "C1102", "Can not drop rule, tables %s in the rule 
are still in used."),
 
-    RESOURCE_IN_USED(11003, "C11003", "Can not drop resources, resources %s in 
the rule are still in used."),
+    RESOURCE_IN_USED(1103, "C1103", "Can not drop resources, resources %s in 
the rule are still in used."),
     
-    RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s 
do not exist."),
+    RESOURCE_NOT_EXIST(1104, "C1104", "Can not drop resources, resources %s do 
not exist."),
     
-    REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule does not 
exist."),
+    REPLICA_QUERY_RULE_NOT_EXIST(1105, "C1105", "Replica query rule does not 
exist."),
     
-    REPLICA_QUERY_RULE_DATA_SOURCE_NOT_EXIST(11006, "C11006", "Data sources %s 
in replica query rule do not exist."),
+    REPLICA_QUERY_RULE_DATA_SOURCE_NOT_EXIST(1106, "C1106", "Data sources %s 
in replica query rule do not exist."),
     
-    ADD_REPLICA_QUERY_RULE_DATA_SOURCE_EXIST(11007, "C11007", "Can not add 
replica query rule, data sources %s in replica query rule already exists."),
+    ADD_REPLICA_QUERY_RULE_DATA_SOURCE_EXIST(1107, "C1107", "Can not add 
replica query rule, data sources %s in replica query rule already exists."),
     
-    REPLICA_QUERY_RULE_EXIST(11008, "C11008", "Replica query rule already 
exists."),
+    REPLICA_QUERY_RULE_EXIST(1108, "C1108", "Replica query rule already 
exists."),
     
-    SHARDING_RULE_NOT_EXIST(11009, "C11009", "Sharding rule does not exist."),
+    SHARDING_RULE_NOT_EXIST(1109, "C1109", "Sharding rule does not exist."),
     
-    SHARDING_TABLE_RULE_EXIST(11010, "C11010", "Sharding table rules: [%s] 
already exists."),
+    SHARDING_TABLE_RULE_EXIST(1110, "C1110", "Sharding table rules: [%s] 
already exists."),
     
-    SCALING_JOB_NOT_EXIST(12001, "C12001", "Scaling job %s does not exist."),
+    SCALING_JOB_NOT_EXIST(1201, "C1201", "Scaling job %s does not exist."),
     
-    SCALING_OPERATE_FAILED(12009, "C12009", "Scaling Operate Failed: [%s]"),
+    SCALING_OPERATE_FAILED(1209, "C1209", "Scaling Operate Failed: [%s]"),
     
-    UNSUPPORTED_COMMAND(19998, "C19998", "Unsupported command: [%s]"),
+    UNSUPPORTED_COMMAND(1998, "C1998", "Unsupported command: [%s]"),
     
-    UNKNOWN_EXCEPTION(19999, "C19999", "Unknown exception: [%s]");
+    UNKNOWN_EXCEPTION(1999, "C1999", "Unknown exception: [%s]");
     
     private final int errorCode;
     
diff --git 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
index c30cd93..7a54664 100644
--- 
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
+++ 
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
@@ -26,36 +26,36 @@ public final class CommonErrorCodeTest {
     
     @Test
     public void assertCircuitBreakMode() {
-        assertThat(CommonErrorCode.CIRCUIT_BREAK_MODE.getErrorCode(), 
is(10000));
-        assertThat(CommonErrorCode.CIRCUIT_BREAK_MODE.getSqlState(), 
is("C10000"));
+        assertThat(CommonErrorCode.CIRCUIT_BREAK_MODE.getErrorCode(), 
is(1000));
+        assertThat(CommonErrorCode.CIRCUIT_BREAK_MODE.getSqlState(), 
is("C1000"));
         assertThat(CommonErrorCode.CIRCUIT_BREAK_MODE.getErrorMessage(), 
is("Circuit break mode is ON."));
     }
     
     @Test
     public void assertSharingTableRulesNotExisted() {
-        
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorCode(), 
is(11001));
-        
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getSqlState(), 
is("C11001"));
+        
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorCode(), 
is(1101));
+        
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getSqlState(), 
is("C1101"));
         
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorMessage(), 
is("Sharding table rule %s is not exist."));
     }
     
     @Test
     public void assertTableInUsed() {
-        assertThat(CommonErrorCode.TABLES_IN_USED.getErrorCode(), is(11002));
-        assertThat(CommonErrorCode.TABLES_IN_USED.getSqlState(), is("C11002"));
+        assertThat(CommonErrorCode.TABLES_IN_USED.getErrorCode(), is(1102));
+        assertThat(CommonErrorCode.TABLES_IN_USED.getSqlState(), is("C1102"));
         assertThat(CommonErrorCode.TABLES_IN_USED.getErrorMessage(), is("Can 
not drop rule, tables %s in the rule are still in used."));
     }
     
     @Test
     public void assertUnsupportedCommand() {
-        assertThat(CommonErrorCode.UNSUPPORTED_COMMAND.getErrorCode(), 
is(19998));
-        assertThat(CommonErrorCode.UNSUPPORTED_COMMAND.getSqlState(), 
is("C19998"));
+        assertThat(CommonErrorCode.UNSUPPORTED_COMMAND.getErrorCode(), 
is(1998));
+        assertThat(CommonErrorCode.UNSUPPORTED_COMMAND.getSqlState(), 
is("C1998"));
         assertThat(CommonErrorCode.UNSUPPORTED_COMMAND.getErrorMessage(), 
is("Unsupported command: [%s]"));
     }
     
     @Test
     public void assertUnknownException() {
-        assertThat(CommonErrorCode.UNKNOWN_EXCEPTION.getErrorCode(), 
is(19999));
-        assertThat(CommonErrorCode.UNKNOWN_EXCEPTION.getSqlState(), 
is("C19999"));
+        assertThat(CommonErrorCode.UNKNOWN_EXCEPTION.getErrorCode(), is(1999));
+        assertThat(CommonErrorCode.UNKNOWN_EXCEPTION.getSqlState(), 
is("C1999"));
         assertThat(CommonErrorCode.UNKNOWN_EXCEPTION.getErrorMessage(), 
is("Unknown exception: [%s]"));
     }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactoryTest.java
index 91acaa2..95e09cb 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactoryTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactoryTest.java
@@ -188,8 +188,8 @@ public final class MySQLErrPacketFactoryTest {
     public void assertNewInstanceWithCircuitBreakException() {
         MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new 
CircuitBreakException());
         assertThat(actual.getSequenceId(), is(1));
-        assertThat(actual.getErrorCode(), is(10000));
-        assertThat(actual.getSqlState(), is("C10000"));
+        assertThat(actual.getErrorCode(), is(1000));
+        assertThat(actual.getSqlState(), is("C1000"));
         assertThat(actual.getErrorMessage(), is("Circuit break mode is ON."));
     }
     
@@ -197,8 +197,8 @@ public final class MySQLErrPacketFactoryTest {
     public void assertNewInstanceWithShardingTableRuleNotExistedException() {
         MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new 
ShardingTableRuleNotExistedException(Collections.singleton("tbl")));
         assertThat(actual.getSequenceId(), is(1));
-        assertThat(actual.getErrorCode(), is(11001));
-        assertThat(actual.getSqlState(), is("C11001"));
+        assertThat(actual.getErrorCode(), is(1101));
+        assertThat(actual.getSqlState(), is("C1101"));
         assertThat(actual.getErrorMessage(), is("Sharding table rule [tbl] is 
not exist."));
     }
     
@@ -206,8 +206,8 @@ public final class MySQLErrPacketFactoryTest {
     public void assertNewInstanceWithTablesInUsedException() {
         MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new 
TablesInUsedException(Collections.singleton("tbl")));
         assertThat(actual.getSequenceId(), is(1));
-        assertThat(actual.getErrorCode(), is(11002));
-        assertThat(actual.getSqlState(), is("C11002"));
+        assertThat(actual.getErrorCode(), is(1102));
+        assertThat(actual.getSqlState(), is("C1102"));
         assertThat(actual.getErrorMessage(), is("Can not drop rule, tables 
[tbl] in the rule are still in used."));
     }
 
@@ -215,8 +215,8 @@ public final class MySQLErrPacketFactoryTest {
     public void assertNewInstanceWithUnsupportedCommandException() {
         MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new 
UnsupportedCommandException("No reason"));
         assertThat(actual.getSequenceId(), is(1));
-        assertThat(actual.getErrorCode(), is(19998));
-        assertThat(actual.getSqlState(), is("C19998"));
+        assertThat(actual.getErrorCode(), is(1998));
+        assertThat(actual.getSqlState(), is("C1998"));
         assertThat(actual.getErrorMessage(), is("Unsupported command: [No 
reason]"));
     }
     
@@ -224,8 +224,8 @@ public final class MySQLErrPacketFactoryTest {
     public void assertNewInstanceWithOtherException() {
         MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new 
RuntimeException("No reason"));
         assertThat(actual.getSequenceId(), is(1));
-        assertThat(actual.getErrorCode(), is(19999));
-        assertThat(actual.getSqlState(), is("C19999"));
+        assertThat(actual.getErrorCode(), is(1999));
+        assertThat(actual.getSqlState(), is("C1999"));
         assertThat(actual.getErrorMessage(), is("Unknown exception: [No 
reason]"));
     }
 }

Reply via email to