org.springframework.jdbc.core.RowMapper.mapRow()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(293)

本文整理了Java中org.springframework.jdbc.core.RowMapper.mapRow方法的一些代码示例,展示了RowMapper.mapRow的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RowMapper.mapRow方法的具体详情如下:
包路径:org.springframework.jdbc.core.RowMapper
类名称:RowMapper
方法名:mapRow

RowMapper.mapRow介绍

[英]Implementations must implement this method to map each row of data in the ResultSet. This method should not call next() on the ResultSet; it is only supposed to map values of the current row.
[中]实现必须实现这个方法来映射结果集中的每一行数据。此方法不应在ResultSet上调用next();它只应该映射当前行的值。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public List<T> extractData(ResultSet rs) throws SQLException {
  List<T> results = (this.rowsExpected > 0 ? new ArrayList<>(this.rowsExpected) : new ArrayList<>());
  int rowNum = 0;
  while (rs.next()) {
    results.add(this.rowMapper.mapRow(rs, rowNum++));
  }
  return results;
}

代码示例来源:origin: spring-projects/spring-batch

@Override
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
  return rowMapper.mapRow(rs, currentRow);
}

代码示例来源:origin: spring-projects/spring-batch

@Override
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
  return rowMapper.mapRow(rs, currentRow);
}

代码示例来源:origin: spring-projects/spring-batch

@Override
public List<JobInstance> extractData(ResultSet rs) throws SQLException,
DataAccessException {
  int rowNum = 0;
  while (rowNum < start && rs.next()) {
    rowNum++;
  }
  while (rowNum < start + count && rs.next()) {
    RowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
    list.add(rowMapper.mapRow(rs, rowNum));
    rowNum++;
  }
  return list;
}

代码示例来源:origin: spring-projects/spring-batch

@Override
  public Object extractData(ResultSet rs) throws SQLException,
  DataAccessException {
    int rowNum = 0;
    while (rowNum < start && rs.next()) {
      rowNum++;
    }
    while (rowNum < start + count && rs.next()) {
      RowMapper<JobInstance> rowMapper = new JobInstanceRowMapper();
      list.add(rowMapper.mapRow(rs, rowNum));
      rowNum++;
    }
    return list;
  }
};

代码示例来源:origin: spring-projects/spring-batch

@Test
  public void testRegularUse() throws SQLException {
    setUpResultSetMock(rs);

    assertEquals(expectedDomainObject(), rowMapper().mapRow(rs, IGNORED_ROW_NUMBER));
  }
}

代码示例来源:origin: komoot/photon

@Override
  public PhotonDoc mapRow(ResultSet resultSet, int i) throws SQLException {
    PhotonDoc doc = placeRowMapper.mapRow(resultSet, 0).getBaseDoc();
    completePlace(doc);
    return doc;
  }
});

代码示例来源:origin: komoot/photon

@Override
  public void processRow(ResultSet rs) throws SQLException {
    // turns a placex row into a photon document that gathers all de-normalised information
    NominatimResult docs = placeRowMapper.mapRow(rs, 0);
    if (!docs.isUsefulForIndex()) return; // do not import document
    // finalize document by taking into account the higher level placex rows assigned to this row
    completePlace(docs.getBaseDoc());
    for (PhotonDoc doc : docs.getDocsWithHousenumber()) {
      while (true) {
        try {
          documents.put(doc);
        } catch (InterruptedException e) {
          log.warn("Thread interrupted while placing document in queue.");
          continue;
        }
        break;
      }
      if (counter.incrementAndGet() % progressInterval == 0) {
        final double documentsPerSecond = 1000d * counter.longValue() / (System.currentTimeMillis() - startMillis);
        log.info(String.format("imported %s documents [%.1f/second]", MessageFormat.format("{0}", counter.longValue()), documentsPerSecond));
      }
    }
  }
});

代码示例来源:origin: komoot/photon

@Override
  public void processRow(ResultSet rs) throws SQLException {
    NominatimResult docs = osmlineRowMapper.mapRow(rs, 0);
    if (!docs.isUsefulForIndex()) return; // do not import document
    // finalize document by taking into account the higher level placex rows assigned to this row
    completePlace(docs.getBaseDoc());
    for (PhotonDoc doc : docs.getDocsWithHousenumber()) {
      while (true) {
        try {
          documents.put(doc);
        } catch (InterruptedException e) {
          log.warn("Thread interrupted while placing document in queue.");
          continue;
        }
        break;
      }
      if (counter.incrementAndGet() % progressInterval == 0) {
        final double documentsPerSecond = 1000d * counter.longValue() / (System.currentTimeMillis() - startMillis);
        log.info(String.format("imported %s documents [%.1f/second]", MessageFormat.format("{0}", counter.longValue()), documentsPerSecond));
      }
    }
  }
});

代码示例来源:origin: paoding-code/paoding-rose

return new MapEntryImpl<Object, Object>(key, mapper.mapRow(rs, rowNum));

代码示例来源:origin: org.tinygroup/org.tinygroup.tinydb

private List extractData(ResultSet rs, RowMapper mapper)
    throws SQLException {
  List results = new ArrayList();
  int rowNum = 0;
  while (rs.next()) {
    results.add(mapper.mapRow(rs, rowNum++));
  }
  return results;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.jdbctemplatedslsession

private List extractData(ResultSet rs, RowMapper mapper)
    throws SQLException {
  List results = new ArrayList();
  int rowNum = 0;
  while (rs.next()) {
    results.add(mapper.mapRow(rs, rowNum++));
  }
  return results;
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

public List<T> extractData(ResultSet rs) throws SQLException {
  List<T> results = (this.rowsExpected > 0 ? new ArrayList<T>(this.rowsExpected) : new ArrayList<T>());
  int rowNum = 0;
  while (rs.next()) {
    results.add(this.rowMapper.mapRow(rs, rowNum++));
  }
  return results;
}

代码示例来源:origin: openstreetmap/osmosis

/**
   * {@inheritDoc}
   */
  @Override
  public void processRow(ResultSet rs) throws SQLException {
    listener.process(rowMapper.mapRow(rs, 0), rs);
  }
}

代码示例来源:origin: spring-projects/spring-data-jdbc

@NonNull
  @Override
  public Map.Entry<Object, T> mapRow(ResultSet rs, int rowNum) throws SQLException {
    return new HashMap.SimpleEntry<>(rs.getObject(keyColumn), delegate.mapRow(rs, rowNum));
  }
}

代码示例来源:origin: uk.gov.nationalarchives/droid-results

@Override
  public ProfileResourceNode mapRow(ResultSet rs, int rowNum) throws SQLException {
    ProfileResourceNode node = PROFILE_RESOURCE_NODE_ROW_MAPPER.mapRow(rs, rowNum);
    node.setFilterStatus(rs.getInt("FILTERSTATUS"));
    return node;
  }
};

代码示例来源:origin: com.alexkasko.springjdbc/springjdbc-constructor-mapper

/**
   * {@inheritDoc}
   */
  @Override
  public T mapRow(ResultSet rs, int rowNum) throws SQLException {
    Map<String, ?> map = LOWER_MAPPER.mapRow(rs, rowNum);
    return list.invoke(map);
  }
}

代码示例来源:origin: SmartDataAnalytics/Sparqlify

@Override
protected Binding prefetch() throws Exception {
  if(!rs.next()) {
    return super.finish();
  }
  long rowId = nextRowId++;
  Binding result = rowMapper.mapRow(rs, (int)rowId);
  return result;
}

代码示例来源:origin: digital-preservation/droid

@Override
  public ProfileResourceNode mapRow(ResultSet rs, int rowNum) throws SQLException {
    ProfileResourceNode node = PROFILE_RESOURCE_NODE_ROW_MAPPER.mapRow(rs, rowNum);
    NodeMetaData nodeMetaData = node.getMetaData();
    boolean emptyDir = rs.getBoolean("EMPTY_DIR");
    if (emptyDir && nodeMetaData.getNodeStatus() == NodeStatus.DONE) {
      nodeMetaData.setNodeStatus(NodeStatus.EMPTY);
    }
    return node;
  }
};

代码示例来源:origin: spring-projects/spring-integration-java-dsl

@Override
public T next() {
  try {
    this.rs.next();
    return this.rowMapper.mapRow(this.rs, this.rs.getRow());
  }
  catch (SQLException e) {
    throw new InvalidResultSetAccessException(e);
  }
}

相关文章

RowMapper类方法