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/05/29 09:50:53 UTC

[GitHub] [shardingsphere] zhaolin81 commented on issue #5850: SelectStatement.parameterCount was wrong when sql condition like DATE_FORMAT(data_create_time, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d')

zhaolin81 commented on issue #5850:
URL: https://github.com/apache/shardingsphere/issues/5850#issuecomment-635883311


           PreparedStatement ps = conn.prepareStatement("select * from test where DATE_FORMAT(create_date, '%Y-%m-%d')>= DATE_FORMAT(?, '%Y-%m-%d') limit ?,?");
           ps.setString(1,"2020-02-01");
           ps.setInt(2,1);
           ps.setInt(3,10);
   
   ---
   java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
   	at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:57) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:50) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:48) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:100) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:103) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:87) ~[shardingsphere-sql-parser-binder-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.createRouteContext(DataNodeRouter.java:99) ~[shardingsphere-route-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:89) ~[shardingsphere-route-4.1.0.jar:4.1.0]
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76) ~[shardingsphere-route-4.1.0.jar:4.1.0]
   


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