executeBatch方法详解

PrepareStatement 也是接口
PrepareStatement extends Statement
PrepareStatement 本身没有 int[] executeBatch() throws SQLException 方法
而是继承了Statement的方法,且它们都是接口没有实际实现方法,但Statement
接口对executeBatch()方法做了规范
/**
     * Submits a batch of commands to the database for execution and
     * if all commands execute successfully, returns an array of update counts.
       每次提交一批命令到数据库中执行,如果所有的命令都成功执行了,那么返回一个
       数组,这个数组是说明每条命令所影响的行数
     * The <code>int</code> elements of the array that is returned are ordered
     * to correspond to the commands in the batch, which are ordered
     * according to the order in which they were added to the batch.
       返回的数组中每个整型值都是排过序的,它们的顺序和批量处理中的命令们是一致的,
       命令的顺序是按照它们被加到批处理中的顺序一致。
     * The elements in the array returned by the method <code>executeBatch</code>
     * may be one of the following:
       executeBatch方法返回的数组中的元素可能是下面几种情形之一:
     * <OL>
     * <LI>A number greater than or equal to zero -- indicates that the
     * command was processed successfully and is an update count giving the
     * number of rows in the database that were affected by the command's
     * execution
       一个大于或等于零的数字,简单说来命令成功执行后就返回它所影响到的行的数目
     * <LI>A value of <code>SUCCESS_NO_INFO</code> -- indicates that the command was
     * processed successfully but that the number of rows affected is
     * unknown
       
      * The constant indicating that a batch statement executed successfully
      * but that no count of the number of rows it affected is available.
      int SUCCESS_NO_INFO = -2;
      常量SUCCESS_NO_INFO代表的值=-2,也就是说命令执行成功了但命令影响到的行数
      无法统计,是未知的,只能返回SUCCESS_NO_INFO来说明命令执行情况。
     * <P>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值