当前位置: 首页 > news >正文

外贸网站推广企业wordpress的PHP用什么版本

外贸网站推广企业,wordpress的PHP用什么版本,自学编程,建设营销型网站公司在之前的优惠券兑换码需求中#xff0c;涉及批量写入问题#xff0c;其中有一个关键的连接配置参数非常重要——rewriteBatchedStatements#xff0c;当该值配置为true时#xff0c;Statement将可能对批量插入sql进行重写。 何谓重写#xff1f;原来提交的批量执行语句涉及批量写入问题其中有一个关键的连接配置参数非常重要——rewriteBatchedStatements当该值配置为true时Statement将可能对批量插入sql进行重写。 何谓重写原来提交的批量执行语句100条如下 INSERT INTO dh_redeem_code (code, status, coupon_id, batch_id) VALUES (1,0,100,1); INSERT INTO dh_redeem_code (code, status, coupon_id, batch_id) VALUES (2,0,100,1); ... INSERT INTO dh_redeem_code (code, status, coupon_id, batch_id) VALUES (100,0,100,1); 重写之后的sql语句1条如下 INSERT INTO dh_redeem_code (code, status, coupon_id, batch_id) VALUES (1,0,100,1), (2,0,100,1), ... (100,0,100,1); 本文将从源码层面来对该参数的作用进行分析。笔者采用的mysql数据库驱动依赖库为mysql-connector-java:8.0.30。 首先我们来看一段ClientPreparedStatement.executeBatchInternal()方法的代码这是数据库驱动内部执行批量sql的方法。 if (!this.batchHasPlainStatements this.rewriteBatchedStatements.getValue()) {if (getQueryInfo().isRewritableWithMultiValuesClause()) {return executeBatchWithMultiValuesClause(batchTimeout);}if (!this.batchHasPlainStatements this.query.getBatchedArgs() ! null this.query.getBatchedArgs().size() 3 /* cost of option setting rt-wise */) {return executePreparedBatchAsMultiStatement(batchTimeout);} } 关于batchHasPlainStatements属性如果批处理使用 Statement.addBatchString 显示添加sql语句则该属性值为true否则为false。原文如下 /*** Does the batch (if any) contain plain statements added by Statement.addBatch(String)?* If so, we cant re-write it to use multi-value or multi-queries.*/ protected boolean batchHasPlainStatements false; 第一行代码的意思如果没有使用 Statement.addBatchString 显示添加sql语句并且rewriteBatchedStatements参数值为true则有可能对批量语句进行重写。 继续往下看isRewritableWithMultiValuesClause这个属性值为true则执行executeBatchWithMultiValuesClause方法该方法实现对sql语句的重写。 对于isRewritableWithMultiValuesClause属性的赋值QueryInfo类的构造函数中 public QueryInfo(String sql, Session session, String encoding) {// Check if the statement has potential to be rewritten as a multi-values clause statement, i.e., if it is an INSERT or REPLACE statement and// rewriteBatchedStatements is enabled.boolean rewritableAsMultiValues (isInsert || isReplace) rewriteBatchedStatements;... //这里有很长很长很长一段代码this.isRewritableWithMultiValuesClause rewritableAsMultiValues; } 从第4行代码看出重写的必要条件rewriteBatchedStatements值为true而且必须是插入操作或者REPLACE操作。 再来看看sql语句重写函数executeBatchWithMultiValuesClause(batchTimeout)代码 batchedStatement /* FIXME -if we ever care about folks proxying our JdbcConnection */prepareBatchedInsertSQL(locallyScopedConn, numValuesPerBatch);timeoutTask startQueryTimer(batchedStatement, batchTimeout);numberToExecuteAsMultiValue numBatchedArgs numValuesPerBatch ? numBatchedArgs : numBatchedArgs / numValuesPerBatch;int numberArgsToExecute numberToExecuteAsMultiValue * numValuesPerBatch;for (int i 0; i numberArgsToExecute; i) {if (i ! 0 i % numValuesPerBatch 0) {try {updateCountRunningTotal batchedStatement.executeLargeUpdate();} catch (SQLException ex) {sqlEx handleExceptionForBatch(batchCounter - 1, numValuesPerBatch, updateCounts, ex);}getBatchedGeneratedKeys(batchedStatement);batchedStatement.clearParameters();batchedParamIndex 1;}batchedParamIndex setOneBatchedParameterSet(batchedStatement, batchedParamIndex, this.query.getBatchedArgs().get(batchCounter)); }try {updateCountRunningTotal batchedStatement.executeLargeUpdate(); } catch (SQLException ex) {sqlEx handleExceptionForBatch(batchCounter - 1, numValuesPerBatch, updateCounts, ex); }getBatchedGeneratedKeys(batchedStatement); 上述代码第一行将根据批量sql数量和插入的字段数量构建带有占位符的sql。随后的语句遍历批量sql使用实际的插入参数值替换占位符从而形成一条可执行的批量插入语句。 自此关于rewriteBatchedStatements的源码分析结束如果需要数据库驱动重写批量插入只需要正常使用MybatisPlus的saveBatch方法并在数据库连接中加上rewriteBatchedStatementstrue的配置信息即可。
http://www.hkea.cn/news/14438825/

相关文章:

  • 淄博网站建设优化公司谁会写网站代码
  • 做网站毕设任务书怎么自己搭建一个博客网站
  • 怎么做仲博注册网站wordpress发不了邮件
  • 做a短视频网站上海市奉贤区建设局网站
  • 网站开发的开发语言软件开发项目报价模板
  • 沧州商贸行业网站建设网站开发需求分析与功能设计
  • 四川宜宾市网站建设公司买个机器在家搞加工
  • 成都那家网站制作公司好建设网站号码是多少
  • 做网站的销售团队wordpress用户id
  • 我做网站啦 圆通导航建站宝盒站群版
  • 教学网站建设目的律师如何在网上推广
  • 厦门高端网站案例淘宝联盟怎么建网站
  • mvc网站开发之美wordpress发布文章 更新失败
  • 宁波网站建设费用报价装饰设计效果图
  • 网站对应的ip地址吗软件开发管理制度
  • 网站建设服务费怎么做会计分录常德最新确诊人员名单
  • python网站开发流程图整站网站优化推荐
  • 示范建设验收网站浙江省旅游企业网站建设情况
  • wordpress 兼容php7卢镇seo网站优化排名
  • 写给初学网站开发们的一封信WordPress开发过程
  • ii6创建网站珠海网站建设找哪家好
  • 泰安网站制作工作室青岛软件开发公司排名
  • 什么是电子商务网站建设wordpress分类页面空白
  • 网站改版建设的目的企业邮箱怎么看
  • 还有用的网站wordpress页脚插件
  • 龙华网站建设方案案例怎么认证网站
  • 金种子酒业网站建设ASP网站开发步骤与过程
  • 昌网站建设网页设计实训报告书
  • 做电商需要哪些网站有哪些廊坊网站建设公司
  • 视频素材交易网站建设个人网站建设模板