Example usage for java.sql ResultSet getLong

List of usage examples for java.sql ResultSet getLong

Introduction

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

Prototype

long getLong(String columnLabel) throws SQLException;

Source Link

Document

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

Usage

From source file:com.carfinance.module.customermanage.domain.CustomerInfoRowMapper.java

public CustomerInfo mapRow(ResultSet rs, int arg1) throws SQLException {
    CustomerInfo customerInfo = new CustomerInfo();

    customerInfo.setId(rs.getLong("id"));
    customerInfo.setCertificate_type(rs.getString("certificate_type"));
    customerInfo.setCertificate_no(rs.getString("certificate_no"));
    customerInfo.setCustomer_name(rs.getString("customer_name"));
    customerInfo.setCustomer_dn(rs.getString("customer_dn"));
    customerInfo.setCustomer_email(rs.getString("customer_email"));
    customerInfo.setCreate_at(rs.getDate("create_at"));
    customerInfo.setCreate_by(rs.getLong("create_by"));
    customerInfo.setUpdate_at(rs.getDate("update_at"));
    customerInfo.setUpdate_by(rs.getLong("update_at"));
    customerInfo.setCustomer_type(rs.getString("customer_type"));

    customerInfo.setCustomer_house(rs.getString("customer_house"));
    customerInfo.setCustomer_vehicle(rs.getString("customer_vehicle"));
    customerInfo.setCustomer_guarantee(rs.getString("customer_guarantee"));

    customerInfo.setVip_no(rs.getString("vip_no"));

    customerInfo.setCertificate_url(rs.getString("certificate_url"));
    customerInfo.setCertificate_name(rs.getString("certificate_name"));

    try {/*from  www . j  a  va 2 s.c  o  m*/
        customerInfo.setIdentity_name(rs.getString("identity_name"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setIdentity_url(rs.getString("identity_url"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setHouse_property_name(rs.getString("house_property_name"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setHouse_property_url(rs.getString("house_property_url"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setDriving_license_name(rs.getString("driving_license_name"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setDriving_license_url(rs.getString("driving_license_url"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setOther_name(rs.getString("other_name"));
    } catch (Exception e) {
    }
    try {
        customerInfo.setOther_url(rs.getString("other_url"));
    } catch (Exception e) {
    }

    return customerInfo;
}

From source file:org.inbio.ait.jdbc.mapper.TaxonIndicatorMapper.java

@Override
public TaxonIndicator mapRow(ResultSet rs, int rowNum) throws SQLException {
    TaxonIndicator ti = new TaxonIndicator();
    //Mandatory data
    ti.setIndicator_id(rs.getLong(ph.getIndicator_id()));
    ti.setTaxon_scientific_name(rs.getString(ph.getTaxon_scientific_name()));
    //Aditional data
    if (!ph.getTaxon_indicator_certainty_level().equals("unmapped")) {
        ti.setTaxon_indicator_certainty_level(rs.getString(ph.getTaxon_indicator_certainty_level()));
    }/*from   w w  w.j  av a  2s . c o  m*/
    if (!ph.getTaxon_indicator_evaluation_criteria().equals("unmapped")) {
        ti.setTaxon_indicator_evaluation_criteria(rs.getString(ph.getTaxon_indicator_evaluation_criteria()));
    }
    if (!ph.getTaxon_indicator_regionality().equals("unmapped")) {
        ti.setTaxon_indicator_regionality(rs.getString(ph.getTaxon_indicator_regionality()));
    }
    if (!ph.getTaxon_indicator_temporality().equals("unmapped")) {
        ti.setTaxon_indicator_temporality(rs.getString(ph.getTaxon_indicator_temporality()));
    }
    if (!ph.getTaxon_indicator_references().equals("unmapped")) {
        ti.setTaxon_indicator_references(rs.getString(ph.getTaxon_indicator_references()));
    }
    if (!ph.getTaxon_indicator_notes().equals("unmapped")) {
        ti.setTaxon_indicator_notes(rs.getString(ph.getTaxon_indicator_notes()));
    }
    if (!ph.getTaxon_indicator_valuer_person().equals("unmapped")) {
        ti.setTaxon_indicator_valuer_person(rs.getString(ph.getTaxon_indicator_valuer_person()));
    }
    if (!ph.getComponent_part().equals("unmapped")) {
        ti.setComponent_part(rs.getString(ph.getComponent_part()));
    }
    return ti;
}

From source file:pl.edu.agh.samm.db.impl.mapper.MeasurementValueRowMapper.java

@Override
public MeasurementValue mapRow(ResultSet rs, int arnrg1) throws SQLException {
    MeasurementValue mv = new MeasurementValue();
    mv.setCapabilityUri(rs.getString("capability_uri"));
    mv.setId(rs.getLong("id"));
    mv.setInstanceUri(rs.getString("instance_uri"));
    mv.setTimestamp(new Date(rs.getTimestamp("timestamp").getTime())); // FIXME
    // why/*from   ww w. j a  v a2s. c  o  m*/
    // the
    // heck
    // is
    // has
    // to
    // be
    // like
    // that?
    // HSQL's
    // fault?
    mv.setValue(rs.getDouble("value"));
    return mv;
}

From source file:mum.bigdata.car.recommender.repository.impl.CarRepositoryImpl.java

@Override
public List<Car> buildResult(ResultSet rs) throws SQLException {
    List<Car> cars = new ArrayList<>();
    while (rs.next()) {
        Car car = new Car();
        car.setCid(rs.getLong("car.cid"));
        car.setName(rs.getString("car.name"));
        car.setMake(rs.getString("car.make"));
        car.setModel(rs.getString("car.model"));
        car.setYear(rs.getInt("car.year"));
        car.setMpg(rs.getString("car.mpg"));
        car.setTransmission(rs.getString("car.transmission"));
        car.setDoors(rs.getByte("car.doors"));
        car.setSubmodel(rs.getString("car.submodel"));
        car.setMsrp(rs.getInt("car.msrp"));
        car.setRating(rs.getString("car.rating"));
        car.setConsumerRating(rs.getString("car.customer_rating"));
        car.setPhoto(rs.getString("car.photo"));
        cars.add(car);/*from w ww.  j a  v a2s .  c  o m*/
    }
    return cars;
}

From source file:mx.edu.um.portlets.esu.dao.impl.DiaDaoImpl.java

@Override
public Dia mapRow(ResultSet rs, int i) throws SQLException {
    Dia dia = new Dia();
    dia.setId(rs.getLong("id"));
    dia.setVersion(rs.getInt("version"));
    dia.setFecha(rs.getDate("fecha"));
    dia.setLeccion(rs.getLong("leccion"));
    dia.setLeccionAsset(rs.getLong("leccionAsset"));
    dia.setVersiculo(rs.getLong("versiculo"));
    dia.setVersiculoAsset(rs.getLong("versiculoAsset"));
    dia.setVideo(rs.getLong("video"));
    dia.setDialoga1(rs.getLong("dialoga1"));
    dia.setDialoga2(rs.getLong("dialoga2"));
    dia.setDialoga3(rs.getLong("dialoga3"));
    dia.setDialoga4(rs.getLong("dialoga4"));
    dia.setComunica1(rs.getLong("comunica1"));
    dia.setComunica2(rs.getLong("comunica2"));
    dia.setComunica3(rs.getLong("comunica3"));
    dia.setComunica4(rs.getLong("comunica4"));
    dia.setPodcastSemanal(rs.getLong("podcastsemanal"));
    dia.setPodcastDiario(rs.getLong("podcastdiario"));
    return dia;//from   w  ww .j a  va  2 s  .c  om
}

From source file:io.apiman.manager.api.jdbc.handlers.ClientUsagePerApiHandler.java

/**
 * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
 *///  www .  ja v a  2 s .c om
@Override
public ClientUsagePerApiBean handle(ResultSet rs) throws SQLException {
    ClientUsagePerApiBean rval = new ClientUsagePerApiBean();
    while (rs.next()) {
        String apiId = rs.getString(1);
        long count = rs.getLong(2);
        rval.getData().put(apiId, count);
    }
    return rval;
}

From source file:ems.emsystem.dao.JDBCDepartmentDAOImpl.java

private Department getDepartmentFromResultSet(ResultSet rs) throws SQLException {
    Department dep = new Department();
    dep.setId(rs.getLong("ID"));
    dep.setName(rs.getString("NAME"));
    dep.setDescription(rs.getString("DESCRIPTION"));
    return dep;// w  w w.j av a2 s  . c  o  m
}

From source file:com.ewcms.content.particular.dao.FrontProjectArticleDAO.java

private ProjectArticle interactionRowMapper(ResultSet rs) throws SQLException {
    ProjectArticle vo = new ProjectArticle();
    vo.setId(rs.getLong("id"));
    vo.setDense(Dense.valueOf(rs.getString("dense")));
    vo.setPublished(rs.getDate("published"));
    vo.setProjectBasic(frontProjectBasicDAO.get(rs.getLong("project_basic_code")));
    return vo;/* ww w.  j a v  a2 s .c o  m*/
}

From source file:net.mindengine.oculus.frontend.db.jdbc.MySimpleJdbcDaoSupport.java

public Long queryForLong(String sql) throws Exception {
    logQuery(sql, null);// ww w . j ava  2 s . c o  m
    PreparedStatement ps = getConnection().prepareStatement(sql);
    ps.execute();
    ResultSet rs = ps.getResultSet();
    if (rs.next()) {
        return rs.getLong(1);
    }
    return null;
}

From source file:com.persistent.cloudninja.dao.impl.PartitionStatsAndBWUsageDaoImpl.java

/**
 * Get the DB size for a tenant./*  w  w w. j  a va  2 s.  c  o m*/
 * 
 * @param tenantId.
 * @return the DB size.
 */
@Override
public long getDBSize(String tenantId) {
    long dbSize = 0;
    Connection connection = null;
    PreparedStatement preparedStatement = null;
    try {
        connection = provisionConnectionUtility.getConnection(url, "tnt_" + tenantId, MASTER_DB_USER,
                MASTER_DB_PSWD);
        preparedStatement = connection
                .prepareStatement("SELECT SUM(reserved_page_count)* 8 FROM sys.dm_db_partition_stats");
        ResultSet resultSet = preparedStatement.executeQuery();
        if (resultSet.next()) {
            dbSize = resultSet.getLong(1);
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        provisionConnectionUtility.closeStatement(preparedStatement);
        provisionConnectionUtility.closeConnection(connection);
    }
    return dbSize;
}