You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/03/21 14:52:17 UTC
[shardingsphere] branch master updated: add single's dml of db
(#9744)
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 df9bf93 add single's dml of db (#9744)
df9bf93 is described below
commit df9bf932d93e2f9d4a6f6136fb16eb1f5d8896e2
Author: Jieker <ji...@163.com>
AuthorDate: Sun Mar 21 22:51:41 2021 +0800
add single's dml of db (#9744)
* add single's dml of db
* ci fixed
---
.../dataset/db/batch_insert_into_single_table.xml | 30 ++++++++++++++++++++++
.../dml/dataset/db/delete_single_table_by_id.xml | 27 +++++++++++++++++++
.../cases/dml/dataset/db/update_single_table.xml | 28 ++++++++++++++++++++
.../cases/dml/dml-integration-test-cases.xml | 13 ++++++++++
4 files changed, 98 insertions(+)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/batch_insert_into_single_table.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/batch_insert_into_single_table.xml
new file mode 100644
index 0000000..3b83cec
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/batch_insert_into_single_table.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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.
+ -->
+
+<dataset update-count="2">
+ <metadata data-nodes="db_0.t_single_table">
+ <column name="single_id" type="numeric" />
+ <column name="id" type="numeric" />
+ <column name="status" type="varchar" />
+ </metadata>
+ <row data-node="db_0.t_single_table" values="1, 1000, init" />
+ <row data-node="db_0.t_single_table" values="2, 1101, init" />
+ <row data-node="db_0.t_single_table" values="3, 2300, init" />
+ <row data-node="db_0.t_single_table" values="4, 2401, init" />
+ <row data-node="db_0.t_single_table" values="5, 1001, insert" />
+ <row data-node="db_0.t_single_table" values="6, 2000, insert" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/delete_single_table_by_id.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/delete_single_table_by_id.xml
new file mode 100644
index 0000000..079af7c
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/delete_single_table_by_id.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ 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.
+ -->
+
+<dataset update-count="1">
+ <metadata data-nodes="db_0.t_single_table">
+ <column name="single_id" type="numeric" />
+ <column name="id" type="numeric" />
+ <column name="status" type="varchar" />
+ </metadata>
+ <row data-node="db_0.t_single_table" values="2, 1101, init" />
+ <row data-node="db_0.t_single_table" values="3, 2300, init" />
+ <row data-node="db_0.t_single_table" values="4, 2401, init" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/update_single_table.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/update_single_table.xml
new file mode 100644
index 0000000..d72df30
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dataset/db/update_single_table.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<dataset update-count="4">
+ <metadata data-nodes="db_0.t_single_table">
+ <column name="single_id" type="numeric" />
+ <column name="id" type="numeric" />
+ <column name="status" type="varchar" />
+ </metadata>
+ <row data-node="db_0.t_single_table" values="1, 1000, finished" />
+ <row data-node="db_0.t_single_table" values="2, 1101, finished" />
+ <row data-node="db_0.t_single_table" values="3, 2300, finished" />
+ <row data-node="db_0.t_single_table" values="4, 2401, finished" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
index ec43e72..6437fc0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
@@ -112,6 +112,11 @@
<assertion parameters="2:int, 3:int" expected-data-file="batch_insert_into_broadcast_table.xml" />
</test-case>
+ <test-case sql="INSERT INTO t_single_table(single_id, id, status) values (?, ?, 'insert'),(?, ?, 'insert')" db-types="MySQL,Oracle,SQLServer" scenario-types="db">
+ <assertion parameters="5:int, 1001:int, 6:int, 2000:int" expected-data-file="batch_insert_into_single_table.xml" />
+ </test-case>
+
+
<test-case sql="INSERT INTO t_user(user_id, address_id, pwd, status) values (?, ?, 'a100', 'init'),(?, ?, 'b101', 'init')" scenario-types="encrypt,dbtbl_with_read_write_splitting_and_encrypt">
<assertion parameters="100:int, 100000:int, 101:int, 101000:int" expected-data-file="batch_insert_into_user_table.xml" />
</test-case>
@@ -153,6 +158,10 @@
<assertion expected-data-file="update_broadcast_table.xml" />
</test-case>
+ <test-case sql="UPDATE t_single_table s SET s.status = 'finished'" db-types="MySQL,Oracle,SQLServer" scenario-types="db">
+ <assertion expected-data-file="update_single_table.xml" />
+ </test-case>
+
<test-case sql="UPDATE t_user u SET u.pwd = 'abc' WHERE user_id = 10" scenario-types="encrypt,dbtbl_with_read_write_splitting_and_encrypt">
<assertion expected-data-file="update_user_table.xml" />
</test-case>
@@ -176,6 +185,10 @@
<test-case sql="DELETE FROM t_user WHERE pwd = 'a10'" scenario-types="encrypt,dbtbl_with_read_write_splitting_and_encrypt">
<assertion expected-data-file="delete_user_table.xml" />
</test-case>
+
+ <test-case sql="DELETE FROM t_single_table WHERE single_id = 1" db-types="MySQL,Oracle,SQLServer" scenario-types="db">
+ <assertion expected-data-file="delete_single_table_by_id.xml" />
+ </test-case>
<test-case sql="DELETE /*+ index(status) */ ONLY t_order WHERE status=1 RETURN * LOG ERRORS INTO TABLE_LOG" db-types="Oracle" scenario-types="db,tbl,dbtbl_with_read_write_splitting,read_write_splitting">
<assertion expected-data-file="delete_with_special_comments_return_without_sharding_value.xml" />