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/07/09 10:27:30 UTC

[GitHub] [shardingsphere] zhf122728281 opened a new issue #6311: batch insert have a bug

zhf122728281 opened a new issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311


   
   
   ### Which version of ShardingSphere did you use?
       compile 'org.apache.shardingsphere:sharding-jdbc-spring-namespace:4.1.1'
       compile 'org.apache.shardingsphere:sharding-jdbc-core:4.1.1'
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   <insert id="batchInsert">
           <foreach collection="list" item="item" index="index" separator=";">
               insert into tb
               <trim prefix="(" suffix=")" suffixOverrides=",">
                   <if test="item.t != null">
                       t,
                   </if>
                   <if test="item.v != null">
                       v,
                   </if>
                   <if test="item.id != null">
                       id,
                   </if>
               </trim>
               values
               <trim prefix="(" suffix=")" suffixOverrides=",">
                   <if test="item.t != null">
                       #{item.t},
                   </if>
                   <if test="item.v != null">
                       #{item.v},
                   </if>
                   <if test="item.id != null">
                       #{item.id},
                   </if>
               </trim>
           </foreach>
   
       </insert>
   
   
   insert into tb(t)vaules(?); insert into tb(t,v)vaules(?,?); insert into tb(t,v)vaules(?,?); 
   
   
   I need,  This is a batch insert;
   
   
   ### Actual behavior
   ### Error updating database. Cause: java.sql.SQLException: No value specified for parameter 2 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into tb ( v ) values ( ? ) ; insert into tb ( v ) values ( ? ) ### Cause: java.sql.SQLException: No value specified for parameter 2 ; bad SQL grammar []; nested exception is java.sql.SQLException: No value specified for parameter 2
   org.springframework.jdbc.BadSqlGrammarException: 
   ### Error updating database.  Cause: java.sql.SQLException: No value specified for parameter 2
   ### The error may involve defaultParameterMap
   ### The error occurred while setting parameters
   ### SQL: insert into tb              ( v )              values              ( ? )           ;              insert into tb              ( v )              values              ( ? )
   ### Cause: java.sql.SQLException: No value specified for parameter 2
   ; bad SQL grammar []; nested exception is java.sql.SQLException: No value specified for parameter 2
   	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
   	at com.sun.proxy.$Proxy214.insert(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
   	at com.sun.proxy.$Proxy310.batchInsert(Unknown Source)
   	at cn.com.duiba.kjy.deploy.controller.TestController.batchTb(TestController.java:259)
   	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.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
   	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
   	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
   	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
   	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
   	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
   	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
   	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
   	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
   	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
   	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
   	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 cn.com.duibaboot.ext.autoconfigure.actuate.SecurityEndpointWebMvcManagementContextConfiguration$ServletEndpointSecurityfilter.doFilter(SecurityEndpointWebMvcManagementContextConfiguration.java:133)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at brave.servlet.TracingFilter.doFilter(TracingFilter.java:68)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.web.ClientAbortExceptionIgnoreFilter.doFilter(ClientAbortExceptionIgnoreFilter.java:24)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.flowreplay.record.aop.RecordSpringMvcFilter.doFilter(RecordSpringMvcFilter.java:70)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.web.DBTimeProfileFilter.doFilter(DBTimeProfileFilter.java:36)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.web.cookie.Rfc2109CookieFixFilter.doFilter(Rfc2109CookieFixFilter.java:19)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.security.SecurityCheckSandbox.doFilter(SecurityCheckSandbox.java:36)
   	at cn.com.duibaboot.ext.autoconfigure.security.SecurityFilter.doFilter(SecurityFilter.java:75)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.cloud.zipkin.DuibaTraceSecondFilter.doFilter(DuibaTraceSecondFilter.java:64)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at brave.servlet.TracingFilter.doFilter(TracingFilter.java:87)
   	at org.springframework.cloud.sleuth.instrument.web.LazyTracingFilter.doFilter(TraceWebServletAutoConfiguration.java:139)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.cloud.zipkin.DuibaTraceFilter.doFilter(DuibaTraceFilter.java:42)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.grouping.filter.ServiceGroupFilter.doFilter(ServiceGroupFilter.java:67)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.perftest.filter.PerfTestFilter.doFilter(PerfTestFilter.java:63)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.web.FeatureFilter.doFilter(FeatureFilter.java:40)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:109)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at cn.com.duibaboot.ext.autoconfigure.web.FailFastFilter.doFilter(FailFastFilter.java:30)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
   	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	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:96)
   	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
   	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
   	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
   	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747)
   	at cn.com.duibaboot.ext.autoconfigure.web.container.TomcatIpRecordValve.invoke(TomcatIpRecordValve.java:33)
   	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
   	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
   	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
   	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
   	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   	at cn.com.duibaboot.ext.autoconfigure.threadpool.proxy.MonitorRunnable.run(MonitorRunnable.java:85)
   	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: java.sql.SQLException: No value specified for parameter 2
   	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
   	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
   	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
   	at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:396)
   	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:197)
   	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:197)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.EncryptPreparedStatement.execute(EncryptPreparedStatement.java:139)
   	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.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
   	at com.sun.proxy.$Proxy554.execute(Unknown Source)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
   	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
   	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   	at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
   	at cn.com.duibaboot.ext.autoconfigure.flowreplay.record.aop.RecordMybatisPlugin.intercept(RecordMybatisPlugin.java:30)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
   	at com.sun.proxy.$Proxy553.update(Unknown Source)
   	at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
   	at cn.com.duibaboot.ext.autoconfigure.cat.CatMybatisPlugin.intercept(CatMybatisPlugin.java:58)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
   	at com.sun.proxy.$Proxy553.update(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.ibatis.plugin.Invocation.proceed(Invocation.java:49)
   	at cn.com.duibaboot.ext.autoconfigure.cat.SleuthMybatisPlugin.intercept(SleuthMybatisPlugin.java:92)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
   	at com.sun.proxy.$Proxy553.update(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
   	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:433)
   	... 107 more
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### 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



[GitHub] [shardingsphere] kimmking commented on issue #6311: batch insert have a bug

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


   you should use the logic sql:
   ```
   insert into tb
   ( v )
   values
   ( ? ),( ? )
   ```
   
   instead of two insert in one line.


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



[GitHub] [shardingsphere] kimmking commented on issue #6311: batch insert have a bug

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


   Your origin case isn't support by ss now.
   And one logic sql that contains multiple actual sqls, is no plan for next 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.

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



[GitHub] [shardingsphere] zhf122728281 edited a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 edited a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656466205


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   logicSQL :insert into tb
                ( v ) 
               values
                ( ? ) 
            ; 
               insert into tb
                ( v ) 
               values
                ( ? )
   ;
   
   log("Actual SQL: {} ::: {} ::: {}", each.getDataSourceName(), each.getSqlUnit().getSql(), each.getSqlUnit().getParameters());
   
   ![image](https://user-images.githubusercontent.com/20379651/87114236-aeb7e800-c2a2-11ea-8f32-337b50614ad0.png)
   
   
   finally ,  parameters just one ;   Actually, there should be two


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



[GitHub] [shardingsphere] zhf122728281 removed a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 removed a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656456808


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   <encrypt:data-source id="encryptDataSource" data-source-name="kjyNewDataSource" >
           <encrypt:encrypt-rule>
               <encrypt:tables>
                   <encrypt:table name="tb">
                       <encrypt:column logic-column="v" cipher-column="v_cipher" plain-column="v" encryptor-ref="custom_encryptor_aes" />
                   </encrypt:table>
               </encrypt:tables>
               <encrypt:encryptors>
                   <encrypt:encryptor id="custom_encryptor_aes" type="CustomAes" props-ref="props"/>
               </encrypt:encryptors>
           </encrypt:encrypt-rule>
           <encrypt:props>
               <prop key="sql.show">true</prop>
               <prop key="query.with.cipher.column">false</prop>
           </encrypt:props>
       </encrypt:data-source>
   


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   ![image](https://user-images.githubusercontent.com/20379651/87032952-f8a7bc00-c217-11ea-9d3a-68551b400f22.png)
   


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > > Hi @zhf122728281
   > > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > > Trista
   > 
   > 11:00:55.858 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==> Preparing: insert into tb ( v ) values ( ? ) ; insert into tb ( v ) values ( ? )
   > 11:00:55.860 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==> Parameters: fds(String), fafs32(String)
   
   ‘sql.show as true’ is invalid
   
   ![image](https://user-images.githubusercontent.com/20379651/87112542-aeb5e900-c29e-11ea-872a-66214e0fb7ab.png)
   


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



[GitHub] [shardingsphere] zhf122728281 removed a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 removed a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656457116






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



[GitHub] [shardingsphere] tristaZero edited a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656452563


   Hi @zhf122728281 
   Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is. 
   BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   
   Trista


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



[GitHub] [shardingsphere] zhf122728281 removed a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 removed a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656065473


   ![image](https://user-images.githubusercontent.com/20379651/87032952-f8a7bc00-c217-11ea-9d3a-68551b400f22.png)
   


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   log("Actual SQL: {} ::: {} ::: {}", each.getDataSourceName(), each.getSqlUnit().getSql(), each.getSqlUnit().getParameters());
   
   ![image](https://user-images.githubusercontent.com/20379651/87114236-aeb7e800-c2a2-11ea-8f32-337b50614ad0.png)
   
   
   finally ,  parameters just one ;   Actually, there should be two


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



[GitHub] [shardingsphere] tristaZero commented on issue #6311: batch insert have a bug

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


   Hi @zhf122728281 
   Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is. 
   BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   11:58:58.411 INFO  [http-nio-9911-exec-7,b4ea394b02aafbb6,f09a8303b3738c15,true,10.10.92.101] ShardingSphere-SQL[SQLLogger.java:74] -> Logic SQL: insert into tb
                ( v ) 
               values
                ( ? ) 
            ; 
               insert into tb
                ( v ) 
               values
                ( ? )
   11:58:58.411 INFO  [http-nio-9911-exec-7,b4ea394b02aafbb6,f09a8303b3738c15,true,10.10.92.101] ShardingSphere-SQL[SQLLogger.java:74] -> SQLStatement: InsertStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.InsertStatement@5df92ea9, tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@7cb5d37a), tablesContext=org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContext@7cb5d37a, columnNames=[v], insertValueContexts=[InsertValueContext(parametersCount=1, valueExpressions=[ParameterMarkerExpressionSegment(startIndex=69, stopIndex=69, parameterMarkerIndex=0)], parameters=[fds])], generatedKeyContext=Optional.empty)
   11:58:58.414 INFO  [http-nio-9911-exec-7,b4ea394b02aafbb6,f09a8303b3738c15,true,10.10.92.101] ShardingSphere-SQL[SQLLogger.java:74] -> Actual SQL: ds ::: insert into tb
                ( v ) 
               values
                ( ? ) 
            ; 
               insert into tb
                ( v ) 
               values
                ( ? ) ::: [fds]


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > you should use the logic sql:
   > 
   > ```
   > insert into tb
   > ( v )
   > values
   > ( ? ),( ? )
   > ```
   > 
   > instead of two insert in one line.
   
   I know it works.  but It has been used extensively in the project.   It would be costly to modify it.


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   11:00:55.858 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==>  Preparing: insert into tb ( v ) values ( ? ) ; insert into tb ( v ) values ( ? ) 
   11:00:55.860 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==> Parameters: fds(String), fafs32(String)


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



[GitHub] [shardingsphere] zhf122728281 edited a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 edited a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656466205


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   logicSQL :insert into tb
                ( v ) 
               values
                ( ? ) 
            ; 
               insert into tb
                ( v ) 
               values
                ( ? )
   
   
   
   log("Actual SQL: {} ::: {} ::: {}", each.getDataSourceName(), each.getSqlUnit().getSql(), each.getSqlUnit().getParameters());
   
   ![image](https://user-images.githubusercontent.com/20379651/87114236-aeb7e800-c2a2-11ea-8f32-337b50614ad0.png)
   
   
   finally ,  parameters just one ;   Actually, there should be two


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > Hi @zhf122728281
   > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > 
   > Trista
   
   <encrypt:data-source id="encryptDataSource" data-source-name="kjyNewDataSource" >
           <encrypt:encrypt-rule>
               <encrypt:tables>
                   <encrypt:table name="tb">
                       <encrypt:column logic-column="v" cipher-column="v_cipher" plain-column="v" encryptor-ref="custom_encryptor_aes" />
                   </encrypt:table>
               </encrypt:tables>
               <encrypt:encryptors>
                   <encrypt:encryptor id="custom_encryptor_aes" type="CustomAes" props-ref="props"/>
               </encrypt:encryptors>
           </encrypt:encrypt-rule>
           <encrypt:props>
               <prop key="sql.show">true</prop>
               <prop key="query.with.cipher.column">false</prop>
           </encrypt:props>
       </encrypt:data-source>
   


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



[GitHub] [shardingsphere] zhf122728281 commented on issue #6311: batch insert have a bug

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


   > rewritten
   
   ‘sql.show as true’   is invalid


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



[GitHub] [shardingsphere] zhf122728281 edited a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
zhf122728281 edited a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656457116


   > > Hi @zhf122728281
   > > Could you set `sql.show` as `true`? Let us look at what SQL passed into ShardingSphere and rewritten SQL is.
   > > BTW, my impression about `batch insert` is like `preparedStatemnt.addBatch()`. Is it your thinking as well?
   > > Trista
   > 
   > 11:00:55.858 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==> Preparing: insert into tb ( v ) values ( ? ) ; insert into tb ( v ) values ( ? )
   > 11:00:55.860 DEBUG [http-nio-9911-exec-182,8a3c4e3850fdea1c,bae549b8988841da,true,10.10.92.101] c.c.d.k.m.d.TbMapper.batchInsert[BaseJdbcLogger.java:159] -> ==> Parameters: fds(String), fafs32(String)
   
   ‘sql.show as true’ is invalid
   
   ![image](https://user-images.githubusercontent.com/20379651/87112655-fb99bf80-c29e-11ea-8485-bed840a2e800.png)
   
   


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



[GitHub] [shardingsphere] tristaZero closed issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311


   


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



[GitHub] [shardingsphere] kimmking edited a comment on issue #6311: batch insert have a bug

Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #6311:
URL: https://github.com/apache/shardingsphere/issues/6311#issuecomment-656503685


   you should use the logic sql:
   ```
   insert into tb
   ( v )
   values
   ( ? ),( ? )
   ```
   
   instead of two insert in one line.
   it means 'foreach' should in values-statement.


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