-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more sql bind test case for delete and update statement (#34150)
- Loading branch information
1 parent
3ca4a31
commit f4afcc3
Showing
4 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
|
||
<sql-parser-test-cases> | ||
<delete sql-case-id="delete_order_by"> | ||
<table name="t_order" start-index="12" stop-index="18"> | ||
<table-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
</table-bound> | ||
</table> | ||
<where start-index="20" stop-index="37"> | ||
<expr> | ||
<binary-operation-expression start-index="26" stop-index="37"> | ||
<left> | ||
<column name="order_id" start-index="26" stop-index="33"> | ||
<column-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
<original-table name="t_order" /> | ||
<original-column name="order_id" start-delimiter="`" end-delimiter="`" /> | ||
</column-bound> | ||
</column> | ||
</left> | ||
<operator>=</operator> | ||
<right> | ||
<literal-expression value="1" start-index="37" stop-index="37" /> | ||
</right> | ||
</binary-operation-expression> | ||
</expr> | ||
</where> | ||
<order-by> | ||
<column-item name="user_id" start-index="48" stop-index="54"> | ||
<column-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
<original-table name="t_order" /> | ||
<original-column name="user_id" start-delimiter="`" end-delimiter="`" /> | ||
</column-bound> | ||
</column-item> | ||
</order-by> | ||
<limit start-index="56" stop-index="62"> | ||
<row-count value="1" start-index="62" stop-index="62" /> | ||
</limit> | ||
</delete> | ||
</sql-parser-test-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
|
||
<sql-parser-test-cases> | ||
<update sql-case-id="update_order_by"> | ||
<table start-index="7" stop-index="13"> | ||
<simple-table name="t_order" start-index="7" stop-index="13"> | ||
<table-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
</table-bound> | ||
</simple-table> | ||
</table> | ||
<set start-index="15" stop-index="29"> | ||
<assignment start-index="19" stop-index="29"> | ||
<column name="user_id" start-index="19" stop-index="25"> | ||
<column-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
<original-table name="t_order" /> | ||
<original-column name="user_id" start-delimiter="`" end-delimiter="`" /> | ||
</column-bound> | ||
</column> | ||
<assignment-value> | ||
<literal-expression value="1" start-index="29" stop-index="29" /> | ||
</assignment-value> | ||
</assignment> | ||
</set> | ||
<where start-index="31" stop-index="48"> | ||
<expr> | ||
<binary-operation-expression start-index="37" stop-index="48"> | ||
<left> | ||
<column name="order_id" start-index="37" stop-index="44"> | ||
<column-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
<original-table name="t_order" /> | ||
<original-column name="order_id" start-delimiter="`" end-delimiter="`" /> | ||
</column-bound> | ||
</column> | ||
</left> | ||
<operator>=</operator> | ||
<right> | ||
<literal-expression value="1" start-index="48" stop-index="48" /> | ||
</right> | ||
</binary-operation-expression> | ||
</expr> | ||
</where> | ||
<order-by> | ||
<column-item name="user_id" start-index="59" stop-index="65"> | ||
<column-bound> | ||
<original-database name="foo_db_1" /> | ||
<original-schema name="foo_db_1" /> | ||
<original-table name="t_order" /> | ||
<original-column name="user_id" start-delimiter="`" end-delimiter="`" /> | ||
</column-bound> | ||
</column-item> | ||
</order-by> | ||
<limit start-index="67" stop-index="73"> | ||
<row-count value="1" start-index="73" stop-index="73" /> | ||
</limit> | ||
</update> | ||
</sql-parser-test-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
|
||
<sql-cases> | ||
<sql-case id="delete_order_by" value="DELETE FROM t_order WHERE order_id = 1 ORDER BY user_id LIMIT 1" db-types="MySQL"/> | ||
</sql-cases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ 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. | ||
--> | ||
|
||
<sql-cases> | ||
<sql-case id="update_order_by" value="UPDATE t_order SET user_id = 1 WHERE order_id = 1 ORDER BY user_id LIMIT 1" db-types="MySQL"/> | ||
</sql-cases> |