Example usage for java.sql ResultSet getInt

List of usage examples for java.sql ResultSet getInt

Introduction

In this page you can find the example usage for java.sql ResultSet getInt.

Prototype

int getInt(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Usage

From source file:com.l2jfree.gameserver.datatables.HennaTable.java

private void fillHennaTable(ResultSet hennaData) throws Exception {
    while (hennaData.next()) {
        int id = hennaData.getInt("symbol_id");

        StatsSet hennaDat = new StatsSet();
        hennaDat.set("symbol_id", id);
        hennaDat.set("symbol_name", hennaData.getString("symbol_name"));
        hennaDat.set("dye_id", hennaData.getInt("dye_id"));
        hennaDat.set("price", hennaData.getInt("price"));
        hennaDat.set("dye_amount", hennaData.getInt("dye_amount"));
        hennaDat.set("mod_INT", hennaData.getInt("mod_INT"));
        hennaDat.set("mod_STR", hennaData.getInt("mod_STR"));
        hennaDat.set("mod_CON", hennaData.getInt("mod_CON"));
        hennaDat.set("mod_MEN", hennaData.getInt("mod_MEN"));
        hennaDat.set("mod_DEX", hennaData.getInt("mod_DEX"));
        hennaDat.set("mod_WIT", hennaData.getInt("mod_WIT"));

        _henna.put(id, new L2Henna(hennaDat));
    }/*from w  w  w  .  j  a  va2  s.c om*/
    _log.info("HennaTable: Loaded " + _henna.size() + " Templates.");
}

From source file:edu.umd.cs.marmoset.modelClasses.CodeMetrics.java

public int fetchValues(ResultSet rs, int startingFrom) throws SQLException {
    setTestRunPK(rs.getInt(startingFrom++));
    setMd5sumSourcefiles(rs.getString(startingFrom++));
    setMd5sumClassfiles(rs.getString(startingFrom++));
    setCodeSegmentSize(rs.getInt(startingFrom++));
    return startingFrom;
}

From source file:com.leapfrog.inventorymanagementsystem.dao.impl.CategoryDAOImpl.java

@Override
public Category getById(int id) throws SQLException, ClassNotFoundException {
    String sql = "SELECT * FROM tbl_category WHERE category_id =?";
    return jdbcTemplate.queryForObject(sql, new Object[] { id }, new RowMapper<Category>() {

        @Override/*from w  w  w .j  av  a 2 s  .  c o  m*/
        public Category mapRow(ResultSet rs, int i) throws SQLException {
            Category c = new Category();
            c.setId(rs.getInt("category_id"));
            c.setCategoryName(rs.getString("category_name"));

            return c;
        }
    });
}

From source file:com.leapfrog.inventorymanagementsystem.dao.impl.CategoryDAOImpl.java

@Override
public List<Category> getALL() throws SQLException, ClassNotFoundException {
    String sql = "SELECT * FROM tbl_category";

    return jdbcTemplate.query(sql, new RowMapper<Category>() {

        @Override/*from www .  ja va  2 s . co  m*/
        public Category mapRow(ResultSet rs, int i) throws SQLException {
            Category c = new Category();
            c.setId(rs.getInt("category_id"));
            c.setCategoryName(rs.getString("category_name"));

            return c;
        }
    });
}

From source file:com.leapfrog.project.DAO.Impl.ProductDAOImpl.java

@Override
public List<Product> getById(int id) throws SQLException, ClassNotFoundException {

    String sql = "SELECT * FROM product WHERE id=?";

    return jdbcTemplate.query(sql, new RowMapper<Product>() {
        @Override//ww  w.  j  a va 2s. c om
        public Product mapRow(ResultSet rs, int i) throws SQLException {

            Product p = new Product();
            p.setId(rs.getInt("id"));
            p.setName(rs.getString("name"));
            p.setDescription(rs.getString("description"));
            p.setCostPrice(rs.getInt("costPrice"));
            p.setSellingPrice(rs.getInt("sellingPrice"));

            return p;
        }
    }, new Object[] { id });

}

From source file:com.rakesh.rp3599.repository.ApplicationRepository.java

public List<Application> findAll() {
    return jdbcTemplate.query(ApplicationUtil.SELECT_AGENCY, new RowMapper<Application>() {
        public Application mapRow(ResultSet rs, int rownumber) throws SQLException {
            Application e = new Application();
            e.setId(rs.getInt("id"));
            e.setCompanyName(rs.getString("company_name"));
            return e;
        }//from w w  w.j av a  2 s .  co  m
    });
}

From source file:ru.org.linux.spring.dao.DeleteInfoDao.java

/**
 * ,     ?//from w  w  w. ja  v  a  2 s.  c om
 * @param id id ? ??
 * @param forUpdate  ?     (SELECT ... FOR UPDATE)
 * @return ?   ?
 */
public DeleteInfo getDeleteInfo(int id, boolean forUpdate) {
    List<DeleteInfo> list = jdbcTemplate.query(forUpdate ? QUERY_DELETE_INFO_FOR_UPDATE : QUERY_DELETE_INFO,
            new RowMapper<DeleteInfo>() {
                @Override
                public DeleteInfo mapRow(ResultSet resultSet, int i) throws SQLException {
                    Integer bonus = resultSet.getInt("bonus");
                    if (resultSet.wasNull()) {
                        bonus = null;
                    }

                    return new DeleteInfo(resultSet.getInt("userid"), resultSet.getString("reason"),
                            resultSet.getTimestamp("deldate"), bonus);
                }
            }, id);

    if (list.isEmpty()) {
        return null;
    } else {
        return list.get(0);
    }
}

From source file:Phnbk.java

private void printOutDetails(ResultSet result) throws SQLException {

    System.out.println("ID : " + result.getInt("id"));
    System.out.println("Name : " + result.getString("name"));
    System.out.println("Address : " + result.getString("address"));

}

From source file:com.ethlo.kfka.mysql.TestCfg.java

@Bean
public KfkaMapStore<CustomKfkaMessage> mapStore(DataSource ds) {
    final RowMapper<CustomKfkaMessage> ROW_MAPPER = new RowMapper<CustomKfkaMessage>() {
        @Override//from  ww w .  ja v a 2s  . co  m
        public CustomKfkaMessage mapRow(ResultSet rs, int rowNum) throws SQLException {
            return new CustomKfkaMessageBuilder().userId(rs.getInt("userId")).payload(rs.getBytes("payload"))
                    .timestamp(rs.getLong("timestamp")).topic(rs.getString("topic")).type(rs.getString("type"))
                    .id(rs.getLong("id")).build();
        }
    };

    return new MysqlKfkaMapStore<CustomKfkaMessage>(ds, ROW_MAPPER);
}

From source file:com.ewcms.component.gwh.dao.GwhDAO.java

private ChannelVO channelRowMapper(ResultSet rs) throws SQLException {
    ChannelVO vo = new ChannelVO();
    vo.setId(rs.getInt("id"));
    vo.setChannelName(rs.getString("name"));
    return vo;/*from  w w w  . ja v  a 2 s.  c om*/
}