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 2020/02/06 11:50:16 UTC

[GitHub] [incubator-shardingsphere] xiyelife opened a new issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException.

xiyelife opened a new issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException. 
URL: https://github.com/apache/incubator-shardingsphere/issues/4188
 
 
   ### Which version of ShardingSphere did you use?
   4.0.0
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   ### Expected behavior
   select SQL execute successfully.
   ### Actual behavior
   ```
   java.lang.StringIndexOutOfBoundsException: String index out of range: -3
   
   	at java.lang.String.substring(String.java:1955)
   	at org.apache.shardingsphere.underlying.rewrite.sql.impl.AbstractSQLBuilder.getConjunctionText(AbstractSQLBuilder.java:58)
   	at org.apache.shardingsphere.underlying.rewrite.sql.impl.AbstractSQLBuilder.toSQL(AbstractSQLBuilder.java:50)
   	at org.apache.shardingsphere.underlying.rewrite.engine.impl.DefaultSQLRewriteEngine.rewrite(DefaultSQLRewriteEngine.java:34)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.getSQLUnit(EncryptPreparedStatement.java:181)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.executeQuery(EncryptPreparedStatement.java:120)
   ```
   ### Reason analyze (If you can)
   The SQL parse result like this :
   ![image](https://user-images.githubusercontent.com/8772975/73934497-899d0300-4919-11ea-839b-e076ed32c321.png)
   It cause the rewrited SQL tokens are repeated, and the rewrite indexs are error.
   ![image](https://user-images.githubusercontent.com/8772975/73934533-9c173c80-4919-11ea-962e-6590a318d097.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   `SELECT * FROM t_query_encrypt WHERE pwd = ? and (id = ? or id =?)`
   ### Example codes for reproduce this issue (such as a github link).
   

----------------------------------------------------------------
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

[GitHub] [incubator-shardingsphere] xiyelife commented on issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
xiyelife commented on issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException. 
URL: https://github.com/apache/incubator-shardingsphere/issues/4188#issuecomment-583270289
 
 
   where's predicate contains `OR` operator that makes encrypt rewrite sql tokens duplicated. And the SQL parse is ok.
   

----------------------------------------------------------------
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

[GitHub] [incubator-shardingsphere] xiyelife edited a comment on issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
xiyelife edited a comment on issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException. 
URL: https://github.com/apache/incubator-shardingsphere/issues/4188#issuecomment-583270289
 
 
   where predicate contains `OR` operator that makes encrypt rewrite sql tokens duplicated. And the SQL parse is ok.
   

----------------------------------------------------------------
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

[GitHub] [incubator-shardingsphere] terrymanu closed issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #4188: sharding +encrypt rewrite for SQL `select with `OR` and `AND`` cause StringIndexOutOfBoundsException. 
URL: https://github.com/apache/incubator-shardingsphere/issues/4188
 
 
   

----------------------------------------------------------------
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