You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/10/17 02:37:06 UTC
[GitHub] [incubator-shardingsphere] xiyelife commented on a change in pull
request #3295: fixed for #3234 and add the encrypted test case for more
than four cipher coloumns
xiyelife commented on a change in pull request #3295: fixed for #3234 and add the encrypted test case for more than four cipher coloumns
URL: https://github.com/apache/incubator-shardingsphere/pull/3295#discussion_r335787166
##########
File path: sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/feature/encrypt/parameter/impl/EncryptAssignmentParameterRewriter.java
##########
@@ -78,22 +81,24 @@ private SetAssignmentsSegment getSetAssignmentsSegment(final SQLStatement sqlSta
return ((UpdateStatement) sqlStatement).getSetAssignment();
}
- private void encryptParameters(final StandardParameterBuilder parameterBuilder, final String tableName, final AssignmentSegment assignmentSegment, final List<Object> parameters) {
+ private void encryptParameters(final StandardParameterBuilder parameterBuilder, final String tableName, final AssignmentSegment assignmentSegment, final List<Object> parameters,
+ final Collection<String> assistedQueryColumns, final int count) {
Review comment:
Rewrite logic according to Assignment is:
original SQL: insert table set a = ?, b = ?, c = ? value (?, ?, ?)
1.replaced original column by the cipher column:
**insert table set a_enc = ?, b_enc = ?, c_enc = ? value (?, ?, ?)**
2.now set the first original column a after a_enc,
the final a's paramterIndex = a'orignalParameterIndex(0) + count(0) + 1= 1
**insert table set a_enc = ?, a= ?, b_enc = ?, c_enc = ? value (?, ?, ?, ?)**
3.now set the second original column b after b_enc,
the fianl b's parameterIndex = b'orignalParameterIndex(1) + count(1) + 1= 3
**insert table set a_enc = ?, a= ?, b_enc = ?, b = ?, c_enc = ? value (?, ?, ?, ?, ?)**
3.now set the third original column c after c_enc,
the final c's parameterIndex = c'orignalParameterIndex(2) + count(2) + 1= 5
**insert table set a_enc = ?, a= ?, b_enc = ?, b = ?, c_enc = ?,c = ? value (?, ?, ?, ?, ?, ?)**
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services