Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.RowCallbackHandler


    jdbcTemplate.query(
      "SELECT tags_values.value FROM user_tags, tags_values WHERE " +
        "user_tags.user_id=:user_id AND tags_values.id=user_tags.tag_id AND user_tags.is_favorite=:is_favorite " +
        "ORDER BY value",
      parameters,
      new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet rs) throws SQLException {
          tags.add(rs.getString("value"));
        }
      }
View Full Code Here


  @Override
  public List<Section> getAllSections() {
    final List<Section> sectionList = new ArrayList<>();
    jdbcTemplate.query("SELECT id, name, imagepost, imageallowed, vote, moderate, scroll_mode, restrict_topics FROM sections ORDER BY id",
      new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet rs) throws SQLException {
          Section section = new Section(rs);
          sectionList.add(section);
        }
View Full Code Here

   * @return список игнорируемых
   */
  @Nonnull
  public Set<Integer> get(@Nonnull User user) {
    final Builder<Integer> builder = ImmutableSet.builder();
    jdbcTemplate.query(queryIgnoreList, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet resultSet) throws SQLException {
        builder.add(resultSet.getInt("ignored"));
      }
    }, user.getId());
View Full Code Here

   */
  public List<EditHistoryDto> getEditInfo(int id, EditHistoryObjectTypeEnum objectTypeEnum) {
    final List<EditHistoryDto> editInfoDTOs = new ArrayList<>();
    jdbcTemplate.query(
            "SELECT * FROM edit_info WHERE msgid=? AND object_type = ?::edit_event_type ORDER BY id DESC",
            new RowCallbackHandler() {
              @Override
              public void processRow(ResultSet resultSet) throws SQLException {
                EditHistoryDto editHistoryDto = new EditHistoryDto();
                editHistoryDto.setId(resultSet.getInt("id"));
                editHistoryDto.setMsgid(resultSet.getInt("msgid"));
View Full Code Here

    final Map<Integer, MessageText> out = Maps.newHashMapWithExpectedSize(msgids.size());

    namedJdbcTemplate.query(
            "SELECT message, markup, id FROM msgbase WHERE id IN (:list)",
            ImmutableMap.of("list", msgids),
            new RowCallbackHandler() {
              @Override
              public void processRow(ResultSet resultSet) throws SQLException {
                String text = resultSet.getString("message");
                String markup = resultSet.getString("markup");
                boolean lorcode = !"PLAIN".equals(markup);
View Full Code Here

            return new StreamingStatementCreator(originalCreator);
          }

        };
        final AtomicInteger rowNum = new AtomicInteger(0);
        template.query(sql, params, new RowCallbackHandler() {

          @Override
          public void processRow(ResultSet rs) throws SQLException {
            handler.handleRow(mapper.mapRow(rs, rowNum.incrementAndGet()));
          }
View Full Code Here

        values = set2array(inValuesSet);
      }
    }
    else if (inValues instanceof String) {
      final Set<Object> valuesSet = new HashSet<Object>();
      jdbcTemplate.query((String)inValues, new RowCallbackHandler(){
        @Override
        public void processRow(ResultSet rs) throws SQLException {
          Object value = JdbcUtils.getResultSetValue(rs, 1);
          valuesSet.add(value);
        }
View Full Code Here

 
  public Set<Object> queryForSet(String dataSourceBean, String sql) {
    DataSource dataSource = beanFactory.getBean(dataSourceBean, DataSource.class);
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    final Set<Object> result = new HashSet<Object>();
    jdbcTemplate.query(sql, new RowCallbackHandler(){
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Object value = rs.getObject(1);
        if (value == null) return;
        result.add(value);
View Full Code Here

                + "     join parameters on parameters.id = tiles.parameters_id\n"
                + "group by layer, gridset, z, parameters, parameters_id";
       
        final long total = template.queryForLong("select count(*) from (" + query + ")");
        log.info("Migrating " + total + " parameters from the metastore to the file system");
        template.query(query, new RowCallbackHandler() {

            long count = 0;
           
            public void processRow(ResultSet rs) throws SQLException {
                String layer = rs.getString(1);
View Full Code Here

            "order by layer_id, parameters_id, gridset, z, x, y";

        final long total = template.queryForLong("select count(*) from (" + query + ")");
        log.info("Migrating " + total + " tile creation dates from the metastore to the file system");
       
        template.query(query, new RowCallbackHandler() {
           
            int count = 0;

            public void processRow(ResultSet rs) throws SQLException {
                // read the result set
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.RowCallbackHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.