This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 4d673d5 support query which table has column contains keyword like
'desc' in encrypt. (#13684)
4d673d5 is described below
commit 4d673d5909e2c9b20eaf50092f2517cfd8e34705
Author: tuichenchuxin <[email protected]>
AuthorDate: Fri Nov 19 19:20:14 2021 +0800
support query which table has column contains keyword like 'desc' in
encrypt. (#13684)
---
.../pojo/generic/SubstitutableColumnNameToken.java | 2 +-
.../generic/SubstitutableColumnNameTokenTest.java | 7 +++++
.../statement/EncryptPreparedStatementTest.java | 8 ++---
.../jdbc/core/statement/EncryptStatementTest.java | 2 +-
.../encrypt/case/select_for_query_with_cipher.xml | 8 ++---
.../encrypt/case/select_for_query_with_plain.xml | 6 ++--
.../mix/case/select_for_query_with_cipher.xml | 36 +++++++++++-----------
.../mix/case/select_for_query_with_plain.xml | 16 +++++-----
8 files changed, 46 insertions(+), 39 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameToken.java
b/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameToken.java
index 2663dbe..a3bf3bd 100644
---
a/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameToken.java
+++
b/shardingsphere-infra/shardingsphere-infra-rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameToken.java
@@ -96,7 +96,7 @@ public final class SubstitutableColumnNameToken extends
SQLToken implements Subs
}
builder.append(quoteCharacter.wrap(columnProjection.getName()));
if (columnProjection.getAlias().isPresent()) {
- builder.append(" AS ").append(columnProjection.getAlias().get());
+ builder.append(" AS
").append(quoteCharacter.wrap(columnProjection.getAlias().get()));
}
return builder.toString();
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameTokenTest.java
b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameTokenTest.java
index 02b0808..f83d298 100644
---
a/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameTokenTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-rewrite/src/test/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/SubstitutableColumnNameTokenTest.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic;
import
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.route.context.RouteUnit;
+import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
import org.junit.Test;
import java.util.Collection;
@@ -35,4 +36,10 @@ public final class SubstitutableColumnNameTokenTest {
Collection<ColumnProjection> projections =
Collections.singletonList(new ColumnProjection(null, "id", null));
assertThat(new SubstitutableColumnNameToken(0, 1,
projections).toString(mock(RouteUnit.class)), is("id"));
}
+
+ @Test
+ public void assertToStringWithQuote() {
+ Collection<ColumnProjection> projections =
Collections.singletonList(new ColumnProjection(null, "id", "id"));
+ assertThat(new SubstitutableColumnNameToken(0, 1, projections,
QuoteCharacter.BACK_QUOTE).toString(mock(RouteUnit.class)), is("`id` AS `id`"));
+ }
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
index 51e0c2b..bf414af 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
@@ -164,7 +164,7 @@ public final class EncryptPreparedStatementTest extends
AbstractShardingSphereDa
assertThat(metaData.getColumnCount(), is(2));
for (int i = 0; i < metaData.getColumnCount(); i++) {
assertThat(metaData.getColumnLabel(1), is("id"));
- assertThat(metaData.getColumnLabel(2), is("pwd"));
+ assertThat(metaData.getColumnLabel(2), is("PWD"));
}
}
}
@@ -218,7 +218,7 @@ public final class EncryptPreparedStatementTest extends
AbstractShardingSphereDa
assertThat(metaData.getColumnCount(), is(2));
for (int i = 0; i < metaData.getColumnCount(); i++) {
assertThat(metaData.getColumnLabel(1), is("id"));
- assertThat(metaData.getColumnLabel(2), is("pwd"));
+ assertThat(metaData.getColumnLabel(2), is("PWD"));
}
}
}
@@ -231,8 +231,8 @@ public final class EncryptPreparedStatementTest extends
AbstractShardingSphereDa
assertThat(metaData.getColumnCount(), is(3));
for (int i = 0; i < metaData.getColumnCount(); i++) {
assertThat(metaData.getColumnLabel(1), is("id"));
- assertThat(metaData.getColumnLabel(2), is("plain_pwd"));
- assertThat(metaData.getColumnLabel(3), is("plain_pwd2"));
+ assertThat(metaData.getColumnLabel(2), is("PLAIN_PWD"));
+ assertThat(metaData.getColumnLabel(3), is("PLAIN_PWD2"));
}
}
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
index 6b204ed..fd4e7c2 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
@@ -131,7 +131,7 @@ public final class EncryptStatementTest extends
AbstractShardingSphereDataSource
assertThat(metaData.getColumnCount(), is(2));
for (int i = 0; i < metaData.getColumnCount(); i++) {
assertThat(metaData.getColumnLabel(1), is("id"));
- assertThat(metaData.getColumnLabel(2), is("pwd"));
+ assertThat(metaData.getColumnLabel(2), is("PWD"));
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_cipher.xml
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_cipher.xml
index de53f92..0fa9804 100644
---
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_cipher.xml
+++
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_cipher.xml
@@ -61,17 +61,17 @@
<rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
<input sql="SELECT * FROM t_account" />
- <output sql="SELECT `t_account`.`account_id`,
`t_account`.`cipher_certificate_number` AS certificate_number,
`t_account`.`cipher_password` AS password, `t_account`.`cipher_amount` AS
amount, `t_account`.`status` FROM t_account" />
+ <output sql="SELECT `t_account`.`account_id`,
`t_account`.`cipher_certificate_number` AS `certificate_number`,
`t_account`.`cipher_password` AS `password`, `t_account`.`cipher_amount` AS
`amount`, `t_account`.`status` FROM t_account" />
</rewrite-assertion>
<rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
<input sql="SELECT a.* FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS certificate_number, `a`.`cipher_password` AS password, `a`.`cipher_amount`
AS amount, `a`.`status` FROM t_account a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS `certificate_number`, `a`.`cipher_password` AS `password`,
`a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account a" />
</rewrite-assertion>
<rewrite-assertion
id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
<input sql="SELECT a.*, account_id, 1+1 FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS certificate_number, `a`.`cipher_password` AS password, `a`.`cipher_amount`
AS amount, `a`.`status`, account_id, 1+1 FROM t_account a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS `certificate_number`, `a`.`cipher_password` AS `password`,
`a`.`cipher_amount` AS `amount`, `a`.`status`, account_id, 1+1 FROM t_account
a" />
</rewrite-assertion>
<rewrite-assertion id="select_unqualified_shorthand_projection_with_join"
db-types="MySQL">
@@ -106,7 +106,7 @@
<rewrite-assertion
id="select_not_nested_subquery_in_table_segment_with_shorthand_project"
db-types="MySQL">
<input sql="SELECT u.amount, u.password, o.certificate_number FROM
(SELECT * FROM t_account) o, t_account u WHERE
o.certificate_number=u.certificate_number AND u.password=?" parameters="1" />
- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS
password, o.cipher_certificate_number AS certificate_number FROM (SELECT
`t_account`.`account_id`, `t_account`.`cipher_certificate_number` AS
certificate_number, `t_account`.`assisted_query_certificate_number`,
`t_account`.`cipher_password` AS password,
`t_account`.`assisted_query_password`, `t_account`.`cipher_amount` AS amount,
`t_account`.`status` FROM t_account) o, t_account u WHERE
o.assisted_query_certifica [...]
+ <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS
password, o.cipher_certificate_number AS certificate_number FROM (SELECT
`t_account`.`account_id`, `t_account`.`cipher_certificate_number` AS
`certificate_number`, `t_account`.`assisted_query_certificate_number`,
`t_account`.`cipher_password` AS `password`,
`t_account`.`assisted_query_password`, `t_account`.`cipher_amount` AS `amount`,
`t_account`.`status` FROM t_account) o, t_account u WHERE o.assisted_query_cer
[...]
</rewrite-assertion>
<rewrite-assertion
id="select_not_nested_subquery_in_predicate_right_equal_condition"
db-types="MySQL">
diff --git
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_plain.xml
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_plain.xml
index 3ae8c0e..cb95001 100644
---
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_plain.xml
+++
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/select_for_query_with_plain.xml
@@ -29,17 +29,17 @@
<rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
<input sql="SELECT * FROM t_account_bak" />
- <output sql="SELECT `t_account_bak`.`account_id`,
`t_account_bak`.`cipher_certificate_number` AS certificate_number,
`t_account_bak`.`plain_password` AS password, `t_account_bak`.`plain_amount` AS
amount, `t_account_bak`.`status` FROM t_account_bak" />
+ <output sql="SELECT `t_account_bak`.`account_id`,
`t_account_bak`.`cipher_certificate_number` AS `certificate_number`,
`t_account_bak`.`plain_password` AS `password`, `t_account_bak`.`plain_amount`
AS `amount`, `t_account_bak`.`status` FROM t_account_bak" />
</rewrite-assertion>
<rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
<input sql="SELECT a.* FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS certificate_number, `a`.`plain_password` AS password, `a`.`plain_amount` AS
amount, `a`.`status` FROM t_account_bak a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS `certificate_number`, `a`.`plain_password` AS `password`, `a`.`plain_amount`
AS `amount`, `a`.`status` FROM t_account_bak a" />
</rewrite-assertion>
<rewrite-assertion
id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
<input sql="SELECT a.*, account_id, 1+1 FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS certificate_number, `a`.`plain_password` AS password, `a`.`plain_amount` AS
amount, `a`.`status`, account_id, 1+1 FROM t_account_bak a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number`
AS `certificate_number`, `a`.`plain_password` AS `password`, `a`.`plain_amount`
AS `amount`, `a`.`status`, account_id, 1+1 FROM t_account_bak a" />
</rewrite-assertion>
<rewrite-assertion id="select_join_with_alias" db-types="MySQL">
diff --git
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_cipher.xml
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_cipher.xml
index 628359d..b2e8f52 100644
---
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_cipher.xml
+++
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_cipher.xml
@@ -44,14 +44,14 @@
<rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
<input sql="SELECT * FROM t_account" />
- <output sql="SELECT `t_account_0`.`account_id`,
`t_account_0`.`cipher_password` AS password, `t_account_0`.`cipher_amount` AS
amount, `t_account_0`.`status` FROM t_account_0" />
- <output sql="SELECT `t_account_1`.`account_id`,
`t_account_1`.`cipher_password` AS password, `t_account_1`.`cipher_amount` AS
amount, `t_account_1`.`status` FROM t_account_1" />
+ <output sql="SELECT `t_account_0`.`account_id`,
`t_account_0`.`cipher_password` AS `password`, `t_account_0`.`cipher_amount` AS
`amount`, `t_account_0`.`status` FROM t_account_0" />
+ <output sql="SELECT `t_account_1`.`account_id`,
`t_account_1`.`cipher_password` AS `password`, `t_account_1`.`cipher_amount` AS
`amount`, `t_account_1`.`status` FROM t_account_1" />
</rewrite-assertion>
<rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
<input sql="SELECT a.* FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a" />
</rewrite-assertion>
<rewrite-assertion
id="select_with_sharding_qualified_shorthand_join_table" db-types="MySQL">
@@ -62,39 +62,39 @@
<rewrite-assertion id="select_with_encrypt_qualified_shorthand_join_table"
db-types="MySQL">
<input sql="SELECT a.* FROM t_account a, t_account_detail b where
a.password = b.password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a,
t_account_detail_0 b where a.assisted_query_password =
b.assisted_query_password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a,
t_account_detail_1 b where a.assisted_query_password =
b.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a,
t_account_detail_0 b where a.assisted_query_password =
b.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a,
t_account_detail_1 b where a.assisted_query_password =
b.assisted_query_password" />
</rewrite-assertion>
<rewrite-assertion id="select_with_encrypt_left_join_table"
db-types="MySQL">
<input sql="SELECT a.* FROM t_account a left join t_account_bak b on
a.password = b.account_id left join t_account_detail c on a.password =
c.password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a left
join t_account_bak_0 b on a.assisted_query_password = b.account_id left join
t_account_detail_0 c on a.assisted_query_password = c.assisted_query_password"
/>
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a left
join t_account_bak_1 b on a.assisted_query_password = b.account_id left join
t_account_detail_0 c on a.assisted_query_password = c.assisted_query_password"
/>
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a left
join t_account_bak_0 b on a.assisted_query_password = b.account_id left join
t_account_detail_1 c on a.assisted_query_password = c.assisted_query_password"
/>
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a left
join t_account_bak_1 b on a.assisted_query_password = b.account_id left join
t_account_detail_1 c on a.assisted_query_password = c.assisted_query_password"
/>
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a
left join t_account_bak_0 b on a.assisted_query_password = b.account_id left
join t_account_detail_0 c on a.assisted_query_password =
c.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a
left join t_account_bak_1 b on a.assisted_query_password = b.account_id left
join t_account_detail_0 c on a.assisted_query_password =
c.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a
left join t_account_bak_0 b on a.assisted_query_password = b.account_id left
join t_account_detail_1 c on a.assisted_query_password =
c.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a
left join t_account_bak_1 b on a.assisted_query_password = b.account_id left
join t_account_detail_1 c on a.assisted_query_password =
c.assisted_query_password" />
</rewrite-assertion>
<rewrite-assertion id="select_with_encrypt_right_join_table"
db-types="MySQL">
<input sql="SELECT a.* FROM t_account a right join t_account_detail b
on a.password = b.password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a right
join t_account_detail_0 b on a.assisted_query_password =
b.assisted_query_password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a right
join t_account_detail_1 b on a.assisted_query_password =
b.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a
right join t_account_detail_0 b on a.assisted_query_password =
b.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a
right join t_account_detail_1 b on a.assisted_query_password =
b.assisted_query_password" />
</rewrite-assertion>
<rewrite-assertion id="select_with_encrypt_join_table" db-types="MySQL">
<input sql="SELECT a.* FROM t_account a join t_account_detail b on
a.password = b.password" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_0 a join
t_account_detail_0 b on a.assisted_query_password = b.assisted_query_password"
/>
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status` FROM t_account_1 a join
t_account_detail_1 b on a.assisted_query_password = b.assisted_query_password"
/>
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_0 a
join t_account_detail_0 b on a.assisted_query_password =
b.assisted_query_password" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status` FROM t_account_1 a
join t_account_detail_1 b on a.assisted_query_password =
b.assisted_query_password" />
</rewrite-assertion>
<rewrite-assertion
id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
<input sql="SELECT a.*, account_id, 1+1 FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status`, account_id, 1+1 FROM
t_account_0 a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
password, `a`.`cipher_amount` AS amount, `a`.`status`, account_id, 1+1 FROM
t_account_1 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status`, account_id, 1+1 FROM
t_account_0 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`cipher_password` AS
`password`, `a`.`cipher_amount` AS `amount`, `a`.`status`, account_id, 1+1 FROM
t_account_1 a" />
</rewrite-assertion>
<rewrite-assertion id="select_with_table_qualified_shorthand"
db-types="MySQL">
<input sql="SELECT t_account.* FROM t_account" />
- <output sql="SELECT `t_account_0`.`account_id`,
`t_account_0`.`cipher_password` AS password, `t_account_0`.`cipher_amount` AS
amount, `t_account_0`.`status` FROM t_account_0" />
- <output sql="SELECT `t_account_1`.`account_id`,
`t_account_1`.`cipher_password` AS password, `t_account_1`.`cipher_amount` AS
amount, `t_account_1`.`status` FROM t_account_1" />
+ <output sql="SELECT `t_account_0`.`account_id`,
`t_account_0`.`cipher_password` AS `password`, `t_account_0`.`cipher_amount` AS
`amount`, `t_account_0`.`status` FROM t_account_0" />
+ <output sql="SELECT `t_account_1`.`account_id`,
`t_account_1`.`cipher_password` AS `password`, `t_account_1`.`cipher_amount` AS
`amount`, `t_account_1`.`status` FROM t_account_1" />
</rewrite-assertion>
</rewrite-assertions>
diff --git
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_plain.xml
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_plain.xml
index 304c0c0..57c7cbc 100644
---
a/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_plain.xml
+++
b/shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/mix/case/select_for_query_with_plain.xml
@@ -29,25 +29,25 @@
<rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
<input sql="SELECT * FROM t_account_bak" />
- <output sql="SELECT `t_account_bak_0`.`account_id`,
`t_account_bak_0`.`plain_password` AS password,
`t_account_bak_0`.`plain_amount` AS amount, `t_account_bak_0`.`status` FROM
t_account_bak_0" />
- <output sql="SELECT `t_account_bak_1`.`account_id`,
`t_account_bak_1`.`plain_password` AS password,
`t_account_bak_1`.`plain_amount` AS amount, `t_account_bak_1`.`status` FROM
t_account_bak_1" />
+ <output sql="SELECT `t_account_bak_0`.`account_id`,
`t_account_bak_0`.`plain_password` AS `password`,
`t_account_bak_0`.`plain_amount` AS `amount`, `t_account_bak_0`.`status` FROM
t_account_bak_0" />
+ <output sql="SELECT `t_account_bak_1`.`account_id`,
`t_account_bak_1`.`plain_password` AS `password`,
`t_account_bak_1`.`plain_amount` AS `amount`, `t_account_bak_1`.`status` FROM
t_account_bak_1" />
</rewrite-assertion>
<rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
<input sql="SELECT a.* FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
password, `a`.`plain_amount` AS amount, `a`.`status` FROM t_account_bak_0 a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
password, `a`.`plain_amount` AS amount, `a`.`status` FROM t_account_bak_1 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
`password`, `a`.`plain_amount` AS `amount`, `a`.`status` FROM t_account_bak_0
a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
`password`, `a`.`plain_amount` AS `amount`, `a`.`status` FROM t_account_bak_1
a" />
</rewrite-assertion>
<rewrite-assertion
id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
<input sql="SELECT a.*, account_id, 1+1 FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
password, `a`.`plain_amount` AS amount, `a`.`status`, account_id, 1+1 FROM
t_account_bak_0 a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
password, `a`.`plain_amount` AS amount, `a`.`status`, account_id, 1+1 FROM
t_account_bak_1 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
`password`, `a`.`plain_amount` AS `amount`, `a`.`status`, account_id, 1+1 FROM
t_account_bak_0 a" />
+ <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS
`password`, `a`.`plain_amount` AS `amount`, `a`.`status`, account_id, 1+1 FROM
t_account_bak_1 a" />
</rewrite-assertion>
<rewrite-assertion id="select_with_table_qualified_shorthand"
db-types="MySQL">
<input sql="SELECT t_account_bak.* FROM t_account_bak" />
- <output sql="SELECT `t_account_bak_0`.`account_id`,
`t_account_bak_0`.`plain_password` AS password,
`t_account_bak_0`.`plain_amount` AS amount, `t_account_bak_0`.`status` FROM
t_account_bak_0" />
- <output sql="SELECT `t_account_bak_1`.`account_id`,
`t_account_bak_1`.`plain_password` AS password,
`t_account_bak_1`.`plain_amount` AS amount, `t_account_bak_1`.`status` FROM
t_account_bak_1" />
+ <output sql="SELECT `t_account_bak_0`.`account_id`,
`t_account_bak_0`.`plain_password` AS `password`,
`t_account_bak_0`.`plain_amount` AS `amount`, `t_account_bak_0`.`status` FROM
t_account_bak_0" />
+ <output sql="SELECT `t_account_bak_1`.`account_id`,
`t_account_bak_1`.`plain_password` AS `password`,
`t_account_bak_1`.`plain_amount` AS `amount`, `t_account_bak_1`.`status` FROM
t_account_bak_1" />
</rewrite-assertion>
</rewrite-assertions>