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 2022/10/10 06:40:35 UTC

[GitHub] [shardingsphere] liuzhihui021221 opened a new issue, #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

liuzhihui021221 opened a new issue, #17973:
URL: https://github.com/apache/shardingsphere/issues/17973

   - bom.xml
   ```
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core</artifactId>
       <version>5.0.0</version>
   </dependency>
   <dependency>
       <groupId>com.microsoft.sqlserver</groupId>
       <artifactId>sqljdbc4</artifactId>
       <version>4.0</version>
       <scope>runtime</scope>
   </dependency>
     <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>druid</artifactId>
       <version>1.0.18</version>
   </dependency>
   ```
   - The error message
   
   ```
   org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
   ### Error querying database.  Cause: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
   ### The error may exist in file [D:\code\uw\sovlt-web-service\mesws.web\target\mesws.web-0.0.1-SNAPSHOT\WEB-INF\classes\mybatis\mysql\data\DataQualityParamMapper.xml]
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: SELECT * FROM data_cell_quality_param ORDER BY id DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
   ### Cause: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
   	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
   	at com.sun.proxy.$Proxy167.selectList(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
   	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
   	at com.sun.proxy.$Proxy228.getCellParamListPage(Unknown Source)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
   	at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
   	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
   	at com.sun.proxy.$Proxy229.getCellParamListPage(Unknown Source)
   	at com.mesws.web.webservice.SvoltBusinServiceImpl.TestQuery(SvoltBusinServiceImpl.java:856)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
   	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
   	at com.mesws.web.aspect.SystemLogAop.aroundAdvice(SystemLogAop.java:107)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
   	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
   	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
   	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
   	at com.sun.proxy.$Proxy307.TestQuery(Unknown Source)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
   	at org.apache.cxf.jaxws.JAXWSMethodInvoker.performInvocation(JAXWSMethodInvoker.java:66)
   	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
   	at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:232)
   	at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:85)
   	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
   	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
   	at java.util.concurrent.FutureTask.run(FutureTask.java)
   	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
   	at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
   	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
   	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
   	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
   	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:253)
   	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
   	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
   	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
   	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
   	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
   	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
   	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
   	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
   	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
   	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
   	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
   	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
   	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
   	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
   	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)
   	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
   	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   	at java.lang.Thread.run(Thread.java:748)
   Caused by: org.apache.ibatis.exceptions.PersistenceException: 
   ### Error querying database.  Cause: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
   ### The error may exist in file [D:\code\uw\sovlt-web-service\mesws.web\target\mesws.web-0.0.1-SNAPSHOT\WEB-INF\classes\mybatis\mysql\data\DataQualityParamMapper.xml]
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: SELECT * FROM data_cell_quality_param ORDER BY id DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
   ### Cause: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
   	... 92 more
   Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
   	at java.util.ArrayList.rangeCheck(ArrayList.java:659)
   	at java.util.ArrayList.get(ArrayList.java:435)
   	at org.apache.shardingsphere.infra.binder.segment.select.pagination.PaginationContext.getValue(PaginationContext.java:56)
   	at org.apache.shardingsphere.infra.binder.segment.select.pagination.PaginationContext.<init>(PaginationContext.java:51)
   	at org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.LimitPaginationContextEngine.createPaginationContext(LimitPaginationContextEngine.java:38)
   	at org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.PaginationContextEngine.createPaginationContext(PaginationContextEngine.java:57)
   	at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:91)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:127)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:110)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createLogicSQL(ShardingSpherePreparedStatement.java:385)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:375)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:286)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:59)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:73)
   	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:60)
   	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
   	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)
   	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)
   	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
   	... 98 more
   
   ```


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)
URL: https://github.com/apache/shardingsphere/issues/17973


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1159480974

   No enough energy for SQLServer, could you try to investigate and find the differents with MySQL/Postgres?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] archyly commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by "archyly (via GitHub)" <gi...@apache.org>.
archyly commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1409804519

   
   
   
   
   > I think I found the bug in `org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.impl.SQLServerStatementSQLVisitor`
   > 
   
    Is there any sample code to fix this bug? I tried to compile the sharding source code,but there were some errors。thanks
   
   
   


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] liuzhihui021221 commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
liuzhihui021221 commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1144330481

   @laersheng I didn't solve it.  Are you using the same version?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] archyly commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by "archyly (via GitHub)" <gi...@apache.org>.
archyly commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1409805053

   > I think I found the bug in `org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.impl.SQLServerStatementSQLVisitor`
   > 
   > https://github.com/apache/shardingsphere/blob/ed2ccd1951a48010587533d701d787c77e6f750e/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java#L789
   > 
   > ` ASTNode astNode = visit(ctx.expr(0));` change the `currentParameterIndex` then following code doen't use the `astNode` . it create a new one with the changed value `new ParameterMarkerLimitValueSegment(ctx.expr(0).start.getStartIndex(), ctx.expr(0).stop.getStopIndex(), getCurrentParameterIndex());` the getCurrentParameterIndex will return an increased one , maybe using the `astNode` to convert to the target astNode instead of creating a new one
   > missing the next line rowCount should also change to ` rowcount = new ParameterMarkerLimitValueSegment(ctx.expr(1).start.getStartIndex(), ctx.expr(1).stop.getStopIndex(), ((ParameterMarkerExpressionSegment) astNode).getParameterMarkerIndex());` and tested by my project
   
   Is there any sample code to fix this bug? I tried to compile the sharding source code,but there were some errors。thanks


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] archyly commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by "archyly (via GitHub)" <gi...@apache.org>.
archyly commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1407931145

   i have the same problem,shardingsphere version 5.3.1,when remove` order by` its work 


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] GavinHua commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by "GavinHua (via GitHub)" <gi...@apache.org>.
GavinHua commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1515644377

   #23544
   
   https://github.com/apache/shardingsphere/blob/07eb5011a4f4e2a5bda9e1a5667ed753a8329c0f/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java#L788-L805
   
   
   ```sql
   select id, name, create_time from dbo.test_sharding order by create_time desc 
   OFFSET #{offset} ROWS FETCH NEXT #{rows} ROWS ONLY
   ```
   
   Taking this SQL as an example, there are two parameters, `offset` and `rows`, which means that `parameterMarkerSegments.size()=2`. 
   
   However, when constructing the ParameterMarkerLimitValueSegment, the index used is `parameterMarkerSegments.size()` instead of `parameterMarkerSegments.size() - 1`. 
   
   I think this is what's causing the exception to be thrown in subsequent executions of `java.lang.IndexOutOfBoundsException: Index: 2, Size: 2`.
   


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] laersheng commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
laersheng commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1141759336

   i have the same problem,have you resolved?


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] laersheng commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
laersheng commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1144407712

   > @laersheng I didn't solve it. Are you using the same version?
   
   My version is 5.1.1.
   When using `Preparedstatement`, I found that shardingsphere did not correctly parse the paging parameters, and there was a problem with the index subscript. Maybe it was a bug.
   so I used `${currentPage} `, `${pageSize}` instead of `#{currentPage} `, `#{pageSize}`  in sql, and solved this problem, just like this: 
   `SELECT * FROM data_cell_quality_param ORDER BY id DESC OFFSET ${currentPage} ROWS FETCH NEXT ${pageSize} ROWS ONLY`
   
   you can try it like this.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] mumutu66 commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
mumutu66 commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1212790893

   I think I found the bug in `org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.impl.SQLServerStatementSQLVisitor` 
   https://github.com/apache/shardingsphere/blob/ed2ccd1951a48010587533d701d787c77e6f750e/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java#L789  `  ASTNode astNode = visit(ctx.expr(0));` change the `currentParameterIndex` then following code doen't use the `astNode`  . it create a new one with the changed value `new ParameterMarkerLimitValueSegment(ctx.expr(0).start.getStartIndex(), ctx.expr(0).stop.getStopIndex(), getCurrentParameterIndex());` the getCurrentParameterIndex will return an increased one ,  maybe using the `astNode` to convert to the target astNode instead of creating a new one


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #17973: use SQLServer Paging statements can cause some problems(Normal query does not cause problems)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #17973:
URL: https://github.com/apache/shardingsphere/issues/17973#issuecomment-1272349727

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


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

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org