code: public static <T, E extends Exception> long importData(final Iterator<T> iter, long offset, final long count, final PreparedStatement stmt,
              final int batchSize, final int batchInterval, final Try.Function<? super T, Object[], E> func) throws UncheckedSQLException, E {
          N.checkArgument(offset >= 0 && count >= 0, "'offset'=%s and 'count'=%s can't be negative", offset, count);
          N.checkArgument(batchSize > 0 && batchInterval >= 0, "'batchSize'=%s must be greater than 0 and 'batchInterval'=%s can't be negative", batchSize,
                  batchInterval);
  
          long result = 0;
  
          try {
              while (offset-- > 0 && iter.hasNext()) {
                  iter.next();
              }
  
              Object[] row = null;
  
              while (result < count && iter.hasNext()) {
                  row = func.apply(iter.next());
  
                  if (row == null) {
                      continue;
                  }
  
                  for (int i = 0, len = row.length; i < len; i++) {
                      stmt.setObject(i + 1, row[i]);
                  }
  
                  stmt.addBatch();
  
                  if ((++result % batchSize) == 0) {
                      stmt.executeBatch();
                      stmt.clearBatch();
  
                      if (batchInterval > 0) {
                          N.sleep(batchInterval);
                      }
                  }
              }
  
              if ((result % batchSize) > 0) {
                  stmt.executeBatch();
                  stmt.clearBatch();
              }
          } catch (SQLException e) {
              throw new UncheckedSQLException(e);
          }
  
          return result;
      }
docs: Imports the data from Iterator to database.
  
  @param iter
  @param offset
  @param count
  @param stmt
  @param batchSize
  @param batchInterval
  @param func convert element to the parameters for record insert. Returns a <code>null</code> array to skip the line.
  @return
  @throws UncheckedSQLException