@Override public int[] executeBatch() throws SQLException {
  try {
    int id=getNextId(TraceObject.PREPARED_STATEMENT);
    debugCodeCall("executeBatch");
    if (batchParameters == null) {
      batchParameters=New.arrayList();
    }
    batchIdentities=New.arrayList();
    int size=batchParameters.size();
    int[] result=new int[size];
    boolean error=false;
    SQLException next=null;
    checkClosedForWrite();
    try {
      for (int i=0; i < size; i++) {
        Value[] set=batchParameters.get(i);
        ArrayList<? extends ParameterInterface> parameters=command.getParameters();
        for (int j=0; j < set.length; j++) {
          Value value=set[j];
          ParameterInterface param=parameters.get(j);
          param.setValue(value,false);
        }
        try {
          result[i]=executeUpdateInternal();
          ResultSet rs=conn.getGeneratedKeys(this,id);
          while (rs.next()) {
            batchIdentities.add(rs.getObject(1));
          }
        }
 catch (        Exception re) {
          SQLException e=logAndConvert(re);
          if (next == null) {
            next=e;
          }
 else {
            e.setNextException(next);
            next=e;
          }
          result[i]=Statement.EXECUTE_FAILED;
          error=true;
        }
      }
      batchParameters=null;
      if (error) {
        JdbcBatchUpdateException e=new JdbcBatchUpdateException(next,result);
        throw e;
      }
      return result;
    }
  finally {
      afterWriting();
    }
  }
 catch (  Exception e) {
    throw logAndConvert(e);
  }
}

@ Override public int [ ] executeBatch ( ) throws SQLException { try { int id = getNextId ( TraceObject . PREPARED_STATEMENT ) ; debugCodeCall ( "executeBatch" ) ; if ( batchParameters == null ) { batchParameters = New . arrayList ( ) ; } batchIdentities = New . arrayList ( ) ; int size = batchParameters . size ( ) ; int [ ] result = new int [ size ] ; boolean error = false ; SQLException next = null ; checkClosedForWrite ( ) ; try { for ( int i = 0 ; i < size ; i ++ ) { Value [ ] set = batchParameters . get ( i ) ; ArrayList < ? extends ParameterInterface > parameters = command . getParameters ( ) ; for ( int j = 0 ; j < set . length ; j ++ ) { Value value = set [ j ] ; ParameterInterface param = parameters . get ( j ) ; param . setValue ( value , false ) ; } try { result [ i ] = executeUpdateInternal ( ) ; ResultSet rs = conn . getGeneratedKeys ( this , id ) ; while ( rs . next ( ) ) { batchIdentities . add ( rs . getObject ( 1 ) ) ; } } catch ( Exception re ) { SQLException e = logAndConvert ( re ) ; if ( next == null ) { next = e ; } else { e . setNextException ( next ) ; next = e ; } result [ i ] = Statement . EXECUTE_FAILED ; error = true ; } } batchParameters = null ; if ( error ) { JdbcBatchUpdateException e = new JdbcBatchUpdateException ( next , result ) ; throw e ; } return result ; } finally { afterWriting ( ) ; } } catch ( Exception e ) { throw logAndConvert ( e ) ; } }
executes the batch . if one of the batched statements fails , this database will continue .
