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.persistent.cloudninja.mapper.InstanceHealthKpiValueRowMapper.java

@Override
public InstanceHealthKpiValueEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
    InstanceHealthKpiValueEntity instanceKPI = new InstanceHealthKpiValueEntity();
    instanceKPI.setInstance(rs.getInt("Instance"));
    instanceKPI.setTimestamp(rs.getString("TimeStamp"));
    instanceKPI.setKpiTypeId(rs.getInt("KpiTypeId"));
    instanceKPI.setValue(rs.getDouble("Value"));
    return instanceKPI;
}

From source file:org.killbill.billing.plugin.meter.timeline.shutdown.StartTimesMapper.java

@Override
public StartTimes map(final int index, final ResultSet r, final StatementContext ctx) throws SQLException {
    try {//w w  w .  ja v a 2 s.  c  om
        return new StartTimes(DateTimeUtils.dateTimeFromUnixSeconds(r.getInt("time_inserted")),
                (Map<Integer, Map<Integer, DateTime>>) mapper.readValue(
                        r.getBlob("start_times").getBinaryStream(),
                        new TypeReference<Map<Integer, Map<Integer, DateTime>>>() {
                        }));
    } catch (IOException e) {
        throw new IllegalStateException(String.format("Could not decode the StartTimes map"), e);
    }
}

From source file:com.oltpbenchmark.benchmarks.auctionmark.AuctionMarkProfile.java

private static final void loadItemCategoryCounts(AuctionMarkProfile profile, ResultSet vt) throws SQLException {
    while (vt.next()) {
        int col = 1;
        long i_c_id = vt.getLong(col++);
        int count = vt.getInt(col++);
        profile.items_per_category.put((int) i_c_id, count);
    } // WHILE//from  ww w  . ja va  2s  . c o m
    if (LOG.isDebugEnabled())
        LOG.debug(String.format("Loaded %d CATEGORY records from %s",
                profile.items_per_category.getValueCount(), AuctionMarkConstants.TABLENAME_ITEM));
}

From source file:com.branded.holdings.qpc.repository.jdbc.JdbcVetRepositoryImpl.java

/**
 * Refresh the cache of Vets that the ClinicService is holding.
 *
 * @see com.branded.holdings.qpc.model.service.ClinicService#shouldFindVets()
 *//* ww  w .  j ava2s  . com*/
@Override
public Collection<Vet> findAll() throws DataAccessException {
    List<Vet> vets = new ArrayList<Vet>();
    // Retrieve the list of all vets.
    vets.addAll(
            this.jdbcTemplate.query("SELECT id, first_name, last_name FROM vets ORDER BY last_name,first_name",
                    BeanPropertyRowMapper.newInstance(Vet.class)));

    // Retrieve the list of all possible specialties.
    final List<Specialty> specialties = this.jdbcTemplate.query("SELECT id, name FROM specialties",
            BeanPropertyRowMapper.newInstance(Specialty.class));

    // Build each vet's list of specialties.
    for (Vet vet : vets) {
        final List<Integer> vetSpecialtiesIds = this.jdbcTemplate.query(
                "SELECT specialty_id FROM vet_specialties WHERE vet_id=?",
                new BeanPropertyRowMapper<Integer>() {
                    @Override
                    public Integer mapRow(ResultSet rs, int row) throws SQLException {
                        return Integer.valueOf(rs.getInt(1));
                    }
                }, vet.getId().intValue());
        for (int specialtyId : vetSpecialtiesIds) {
            Specialty specialty = EntityUtils.getById(specialties, Specialty.class, specialtyId);
            vet.addSpecialty(specialty);
        }
    }
    return vets;
}

From source file:com.leapfrog.academyspring.dao.impl.EnquiryDAOImpl.java

@Override
public List<Enquiry> getAll() {

    return jdbcTemplate.query(SQLConstants.ENQUIRY_GETALL, new RowMapper<Enquiry>() {

        @Override/*from w  w  w . j  a va2s .  co m*/
        public Enquiry mapRow(ResultSet rs, int i) throws SQLException {
            Enquiry enq = new Enquiry();

            enq.setId(rs.getInt("id"));
            enq.setFirstName(rs.getString("first_name"));
            enq.setLastName(rs.getString("last_name"));
            enq.setEmail(rs.getString("email"));
            enq.setContactNo(rs.getString("contact_no"));
            enq.setCourseId(rs.getInt("course_id"));
            enq.setMessage(rs.getString("message"));
            enq.setEnquiryDate(rs.getDate("enquiry_date"));
            enq.setIsRead(rs.getBoolean("is_read"));
            enq.setParentId(rs.getInt("parent_id"));

            return enq;
        }
    });
}

From source file:net.sourceforge.vulcan.spring.jdbc.BuildHistoryTopErrorsQuery.java

@Override
protected BuildMessageDto mapRow(ResultSet rs, int rowNumber) throws SQLException {
    final BuildMessageDto dto = new BuildMessageDto();

    dto.setCount(rs.getInt("msg_count"));
    dto.setMessage(rs.getString("message"));

    return dto;/*  w  ww  .  j  a  va 2s .  com*/
}

From source file:com.abcd.employeemaven.dao.impl.EmployeeDaoImpl.java

public Employee mapData(ResultSet rs) throws SQLException {
    Employee employee = new Employee();
    employee.setId(rs.getInt("employee_id"));
    employee.setFirstName(rs.getString("employee_first_name"));
    employee.setLastName(rs.getString("employee_last_name"));
    employee.setEmail(rs.getString("email"));
    employee.setAddress(rs.getString("address"));
    employee.setJoinedDate(rs.getDate("joined_date"));
    employee.setModifiedDate(rs.getDate("modified_date"));
    employee.setEffectiveDate(rs.getDate("effective_date"));
    employee.setStatus(rs.getBoolean("status"));
    return employee;
}

From source file:com.xinferin.dao.DAOProviderImpl.java

@Override
public List<Provider> list() {
    String sql = "SELECT * FROM provider";
    List<Provider> list = jdbcTemplate.query(sql, new RowMapper<Provider>() {
        @Override/*from   w ww  . ja v a  2 s  . com*/
        public Provider mapRow(ResultSet rs, int rowNum) throws SQLException {
            Provider aProvider = new Provider();

            aProvider.setId(rs.getInt("id"));
            aProvider.setName(rs.getString("name"));

            return aProvider;
        }
    });
    return list;
}

From source file:net.freechoice.model.orm.Map_Comment.java

@Override
public FC_Comment mapRow(final ResultSet rs, int rowNum) throws SQLException {

    FC_Comment comment = new FC_Comment();

    comment.id = rs.getInt(1);
    comment.id_post_ = rs.getInt(2);/*from  w ww . ja  va  2 s .c o  m*/
    comment.time_posted = rs.getTimestamp(3);
    comment.email = rs.getString(4);
    comment.name = rs.getString(5);
    comment.comment = rs.getString(6);
    return comment;
}

From source file:net.freechoice.model.orm.Map_User.java

@Override
public FC_User mapRow(final ResultSet rs, int rowNum) throws SQLException {

    FC_User user = new FC_User();

    user.id = rs.getInt(1);
    user.path_avatar = rs.getString(2);//from   w w  w.  j av  a  2  s .c  o m
    user.name_login = rs.getString(3);
    user.name_display = rs.getString(4);
    user.email = rs.getString(5);
    user.password = rs.getString(6);
    user.tagline = rs.getString(7);

    return user;
}