Skip to content

Commit

Permalink
For #3032, add missing mysql test cases for select escape. (#3042)
Browse files Browse the repository at this point in the history
  • Loading branch information
haocao authored and terrymanu committed Sep 16, 2019
1 parent 6d2a110 commit 3ad5af7
Show file tree
Hide file tree
Showing 6 changed files with 307 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--
~ 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>
<metadata>
<column name="status" />
</metadata>
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<!--
~ 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>
<metadata>
<column name="status" />
</metadata>
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--
~ 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>
<metadata>
<column name="status" />
</metadata>
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
<row values="init_slave" />
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
~ 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>
<metadata>
<column name="status" />
</metadata>
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
<row values="init" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,23 @@
<dql-test-case sql-case-id="select_with_double_quotes">
<assertion parameters="100001:int" expected-data-file="select_not_equal_with_single_table.xml" />
</dql-test-case>


<dql-test-case sql-case-id="select_escape_with_single_quota">
<assertion expected-data-file="empty_order.xml" />
</dql-test-case>

<dql-test-case sql-case-id="select_escape_with_double_quota">
<assertion expected-data-file="empty_order.xml" />
</dql-test-case>

<dql-test-case sql-case-id="select_alias_as_single_quote_string">
<assertion expected-data-file="select_alias_as_single_quote_string.xml" />
</dql-test-case>

<dql-test-case sql-case-id="select_alias_as_string_double_quote">
<assertion expected-data-file="select_alias_as_single_quote_string.xml" />
</dql-test-case>

<dql-test-case sql-case-id="select_distinct_with_single_column">
<assertion expected-data-file="select_distinct_with_single_column.xml" />
</dql-test-case>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<sql-case id="select_with_double_quotes" value="SELECT * FROM &quot;t_order_item&quot; WHERE &quot;item_id&quot; != ? ORDER BY &quot;item_id&quot;" db-types="PostgreSQL" />
<sql-case id="select_escape_with_single_quota" value="SELECT * FROM t_order where status='\''" db-types="MySQL" />
<sql-case id="select_escape_with_double_quota" value="SELECT * FROM t_order where status=&quot;\&quot;&quot;" db-types="MySQL" />
<sql-case id="select_alias_as_single_quote_string" value="SELECT status as 'status' FROM t_order" />
<sql-case id="select_alias_as_string_double_quote" value="SELECT status as &quot;status&quot; FROM t_order" />
<sql-case id="select_alias_as_single_quote_string" value="SELECT status as 'status' FROM t_order" db-types="MySQL" />
<sql-case id="select_alias_as_string_double_quote" value="SELECT status as &quot;status&quot; FROM t_order" db-types="MySQL" />
</sql-cases>

0 comments on commit 3ad5af7

Please sign in to comment.