tristaZero commented on a change in pull request #3276: Add table owner for
logic encrypt column
URL:
https://github.com/apache/incubator-shardingsphere/pull/3276#discussion_r334893760
##########
File path:
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/feature/encrypt/EncryptCondition.java
##########
@@ -56,18 +58,20 @@
private final Map<Integer, Object> positionValueMap = new
LinkedHashMap<>();
- public EncryptCondition(final String columnName, final String tableName,
final int startIndex, final int stopIndex, final ExpressionSegment
expressionSegment) {
+ public EncryptCondition(final String columnName, final String tableName,
final String tableOwner, final int startIndex, final int stopIndex, final
ExpressionSegment expressionSegment) {
this.columnName = columnName;
this.tableName = tableName;
+ this.tableOwner = tableOwner;
this.startIndex = startIndex;
this.stopIndex = stopIndex;
operator = ShardingOperator.EQUAL;
putPositionMap(0, expressionSegment);
}
- public EncryptCondition(final String columnName, final String tableName,
final int startIndex, final int stopIndex, final List<ExpressionSegment>
expressionSegments) {
+ public EncryptCondition(final String columnName, final String tableName,
final String tableOwner, final int startIndex, final int stopIndex, final
List<ExpressionSegment> expressionSegments) {
this.columnName = columnName;
this.tableName = tableName;
+ this.tableOwner = tableOwner;
Review comment:
tableName == tableOwner or not?
No, if a table with alias, tableOwner is alias, otherwise, it is tableName.
```
The SQL
select * from table order a where a.pwd = 1;
will be rewritten as
select * from table order a where a.cipher = xxx
not
select * from table order a where order.cipher = xxx
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services