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:io.apiman.manager.api.jdbc.handlers.ResponseStatsHistogramHandler.java

/**
 * @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
 *///from w ww . ja v  a 2s .  c o  m
@Override
public ResponseStatsHistogramBean handle(ResultSet rs) throws SQLException {
    while (rs.next()) {
        long time = rs.getLong(1);
        String rtype = rs.getString(2);
        long count = rs.getLong(3);

        ResponseStatsDataPoint dataPoint = index.get(time);
        if (dataPoint != null) {
            if (rtype == null) {
                dataPoint.setTotal(dataPoint.getErrors() + dataPoint.getFailures() + count);
            } else if (rtype.equals("failure")) { //$NON-NLS-1$
                dataPoint.setTotal(dataPoint.getTotal() + count);
                dataPoint.setFailures(count);
            } else if (rtype.equals("error")) { //$NON-NLS-1$
                dataPoint.setTotal(dataPoint.getTotal() + count);
                dataPoint.setErrors(count);
            }
        }
    }
    return histogram;
}

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

private static final void loadGlobalAttributeGroups(AuctionMarkProfile profile, ResultSet vt)
        throws SQLException {
    while (vt.next()) {
        int col = 1;
        long gag_id = vt.getLong(col++);
        profile.gag_ids.add(new GlobalAttributeGroupId(gag_id));
    } // WHILE/*from  w  w w  .  j a  v a 2s . c  om*/
    if (LOG.isDebugEnabled())
        LOG.debug(String.format("Loaded %d records from %s", profile.gag_ids.size(),
                AuctionMarkConstants.TABLENAME_GLOBAL_ATTRIBUTE_GROUP));
}

From source file:com.carfinance.module.vehiclemanage.domain.VehicleInsuranceRowMapper.java

public VehicleInsurance mapRow(ResultSet rs, int arg1) throws SQLException {
    VehicleInsurance vehicleInfo = new VehicleInsurance();

    vehicleInfo.setId(rs.getLong("id"));
    vehicleInfo.setCarframe_no(rs.getString("carframe_no"));
    vehicleInfo.setEngine_no(rs.getString("engine_no"));
    vehicleInfo.setLicense_plate(rs.getString("license_plate"));
    vehicleInfo.setInsurance_company(rs.getString("insurance_company"));
    vehicleInfo.setStrong_insurance(rs.getDouble("strong_insurance"));
    vehicleInfo.setStrong_insurance_expire_at(rs.getDate("strong_insurance_expire_at"));
    vehicleInfo.setVehicle_vessel_tax(rs.getDouble("vehicle_vessel_tax"));
    vehicleInfo.setBusiness_insurance(rs.getDouble("business_insurance"));
    vehicleInfo.setBusiness_insurance_expire_at(rs.getDate("business_insurance_expire_at"));
    vehicleInfo.setRemark(rs.getString("remark"));
    vehicleInfo.setCreate_by(rs.getLong("create_by"));
    vehicleInfo.setCreate_at(rs.getDate("create_at"));
    vehicleInfo.setCreate_by(rs.getLong("update_by"));
    vehicleInfo.setCreate_at(rs.getDate("update_at"));

    return vehicleInfo;
}

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

@Override
public Country mapRow(ResultSet rs, int rowNum) throws SQLException {
    Country c = new Country();
    //Mandatory data
    c.setCountryId(rs.getLong(ph.getCountryId()));
    c.setCountryName(rs.getString(ph.getCountryName()));
    return c;/*from   w  w w .  ja va 2  s .c o  m*/
}

From source file:uta.ak.usttmp.common.dao.mapper.TextRowMapper.java

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

    try {//www  .  j ava2  s  . c  o m
        Text rt = new Text();
        rt.setId(rs.getLong("mme_eid"));

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        rt.setCreateTime(formatter.parse(rs.getString("text_createdate")));

        rt.setText(rs.getString("text"));
        rt.setTitle(rs.getString("title"));
        rt.setRawTextId(rs.getLong("rawtext_id"));
        rt.setTag(rs.getString("tag"));

        return rt;
    } catch (ParseException ex) {
        Logger.getLogger(RawTextRowMapper.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
}

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

private static final void loadPendingItemComments(AuctionMarkProfile profile, ResultSet vt)
        throws SQLException {
    while (vt.next()) {
        int col = 1;
        long ic_id = vt.getLong(col++);
        long ic_i_id = vt.getLong(col++);
        long ic_u_id = vt.getLong(col++);
        ItemCommentResponse cr = new ItemCommentResponse(ic_id, ic_i_id, ic_u_id);
        profile.pending_commentResponses.add(cr);
    } // WHILE/*from   w w  w.  ja va2  s  .co  m*/
    if (LOG.isDebugEnabled())
        LOG.debug(String.format("Loaded %d records from %s", profile.pending_commentResponses.size(),
                AuctionMarkConstants.TABLENAME_ITEM_COMMENT));
}

From source file:com.persistent.cloudninja.mapper.TopQueriesRowMapper.java

@Override
public TopQueriesEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
    TopQueriesEntity topQueries = new TopQueriesEntity();
    topQueries.setQueryTime(rs.getLong("Avg CPU Time"));
    topQueries.setQuery(rs.getString("Statement Text"));

    return topQueries;
}

From source file:com.springsource.greenhouse.account.AccountMapper.java

public Account mapRow(ResultSet rs, int row) throws SQLException {
    return new Account(rs.getLong("id"), rs.getString("firstName"), rs.getString("lastName"),
            rs.getString("email"), rs.getString("username"), pictureUrlMapper.mapRow(rs, row),
            profileUrlTemplate);/*from   ww w  .  ja  v a  2  s.  c  o m*/
}

From source file:uta.ak.usttmp.common.dao.mapper.RawTextRowMapper.java

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

    try {/*  w ww .j  a  va2s. com*/
        RawText rt = new RawText();
        rt.setId(rs.getLong("mme_eid"));

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        rt.setCreateTime(formatter.parse(rs.getString("text_createdate")));

        rt.setText(rs.getString("text"));
        rt.setTitle(rs.getString("title"));
        rt.setTag(rs.getString("tag"));

        return rt;
    } catch (ParseException ex) {
        Logger.getLogger(RawTextRowMapper.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
}

From source file:com.flexive.core.Database.java

/**
 * Load a FxString from the content data
 *
 * @param con         an open connection
 * @param column      the name of the column from the translations table to load
 * @param whereClause mandatory where clause
 * @return FxString created from the data table
 * @throws SQLException if a database error occurred
 *///from w  w  w . jav a 2s  . c  o m
public static FxString loadContentDataFxString(Connection con, String column, String whereClause)
        throws SQLException {
    Statement stmt = null;
    Map<Long, String> hmTrans = new HashMap<Long, String>(10);
    int defaultLanguageId = -1;
    try {
        stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT LANG, ISMLDEF, " + column + " FROM "
                + DatabaseConst.TBL_CONTENT_DATA + " WHERE " + whereClause);
        while (rs != null && rs.next()) {
            hmTrans.put(rs.getLong(1), rs.getString(3));
            if (rs.getBoolean(2)) {
                defaultLanguageId = rs.getInt(1);
            }
        }
    } finally {
        if (stmt != null)
            stmt.close();
    }
    return new FxString(defaultLanguageId, hmTrans);
}