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.wabacus.system.datatype.LongType.java

public Object getColumnValue(ResultSet rs, int iindex, AbsDatabaseType dbtype) throws SQLException {
    return Long.valueOf(rs.getLong(iindex));
}

From source file:net.bhira.sample.api.jdbc.ContactInfoRowMapper.java

/**
 * Constructor for ContactInfoRowMapper that creates an instance of
 * {@link net.bhira.sample.model.ContactInfo} from row represented by rowNum in the given
 * ResultSet.//from   w  ww .  j av a2 s  .c om
 * 
 * @param rs
 *            an instance of ResultSet to be processed.
 * @param rowNum
 *            integer representing the row number in ResultSet.
 */
@Override
public ContactInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
    ContactInfo contactInfo = new ContactInfo();
    contactInfo.setId(rs.getLong("id"));
    contactInfo.setPhone(rs.getString("phone"));
    contactInfo.setFax(rs.getString("fax"));
    contactInfo.setEmail(rs.getString("email"));
    contactInfo.setWebsite(rs.getString("website"));
    return contactInfo;
}

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

public VehiclePeccancy mapRow(ResultSet rs, int arg1) throws SQLException {
    VehiclePeccancy vehiclePeccancy = new VehiclePeccancy();

    vehiclePeccancy.setId(rs.getLong("id"));
    vehiclePeccancy.setCarframe_no(rs.getString("carframe_no"));
    vehiclePeccancy.setEngine_no(rs.getString("engine_no"));
    vehiclePeccancy.setLicense_plate(rs.getString("license_plate"));
    vehiclePeccancy.setPeccancy_at(rs.getDate("peccancy_at"));
    vehiclePeccancy.setPeccancy_place(rs.getString("peccancy_place"));
    vehiclePeccancy.setPeccancy_reason(rs.getString("peccancy_reason"));
    vehiclePeccancy.setPeccancy_price(rs.getDouble("peccancy_price"));
    vehiclePeccancy.setScore(rs.getInt("score"));
    vehiclePeccancy.setStatus(rs.getInt("status"));
    vehiclePeccancy.setArbitration(rs.getString("arbitration"));
    vehiclePeccancy.setEmployee_id(rs.getString("employee_id"));
    vehiclePeccancy.setEmployee_name(rs.getString("employee_name"));
    vehiclePeccancy.setCustomer_id(rs.getString("customer_id"));
    vehiclePeccancy.setCustomer_name(rs.getString("customer_name"));
    vehiclePeccancy.setCreate_at(rs.getDate("create_at"));
    vehiclePeccancy.setCreate_by(rs.getLong("create_by"));
    vehiclePeccancy.setCreate_at(rs.getDate("update_at"));
    vehiclePeccancy.setCreate_by(rs.getLong("update_by"));

    return vehiclePeccancy;
}

From source file:com.wabacus.system.datatype.LongType.java

public Object getColumnValue(ResultSet rs, String column, AbsDatabaseType dbtype) throws SQLException {
    return Long.valueOf(rs.getLong(column));
}

From source file:net.bhira.sample.api.jdbc.DepartmentRowMapper.java

/**
 * Constructor for DepartmentRowMapper that creates an instance of
 * {@link net.bhira.sample.model.Department} from row represented by rowNum in the given
 * ResultSet.//from  w  ww. j a  v a  2  s .c om
 * 
 * @param rs
 *            an instance of ResultSet to be processed.
 * @param rowNum
 *            integer representing the row number in ResultSet.
 */
@Override
public Department mapRow(ResultSet rs, int rowNum) throws SQLException {
    Department department = new Department();
    department.setId(rs.getLong("id"));
    department.setCompanyId(rs.getLong("companyid"));
    department.setName(rs.getString("name"));
    department.setBillingAddress(rs.getString("billingaddr"));
    department.setShippingAddress(rs.getString("shippingaddr"));
    department.setCreated(rs.getTimestamp("created"));
    department.setModified(rs.getTimestamp("modified"));
    department.setCreatedBy(rs.getString("createdby"));
    department.setModifiedBy(rs.getString("modifiedby"));
    return department;
}

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

public String mapRow(ResultSet rs, int row) throws SQLException {
    Gender gender = Gender.valueOf(rs.getString("gender").charAt(0));
    return urlFactory.pictureUrl(rs.getLong("id"), pictureSize, rs.getBoolean("pictureSet"), gender);
}

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

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

    try {//from  w ww  .j a  v a  2s. c  o  m
        MiningTaskLog mtl = new MiningTaskLog();

        mtl.setId(rs.getLong("mme_eid"));
        mtl.setInfo(rs.getString("exception_info"));

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        mtl.setOccurrenceTime(formatter.parse(rs.getString("exception_time")));

        mtl.setMiningTaskId(rs.getLong("miningtask_id"));
        mtl.setType(rs.getInt("type"));

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

    return null;
}

From source file:annis.sqlgen.AnnotatedSpanExtractor.java

@Override
public AnnotatedSpan mapRow(ResultSet resultSet, int rowNum) throws SQLException {
    long id = resultSet.getLong("id");
    String coveredText = resultSet.getString("span");

    Array arrayAnnotation = resultSet.getArray("annotations");
    ResultSetMetaData rsMeta = resultSet.getMetaData();
    Array arrayMeta = null;//from   w  w  w . j av  a2 s .c  o m
    for (int i = 1; i <= rsMeta.getColumnCount(); i++) {
        if ("metadata".equals(rsMeta.getColumnName(i))) {
            arrayMeta = resultSet.getArray(i);
            break;
        }
    }

    List<Annotation> annotations = extractAnnotations(arrayAnnotation);
    List<Annotation> metaData = arrayMeta == null ? new LinkedList<Annotation>()
            : extractAnnotations(arrayMeta);

    // create key
    Array sqlKey = resultSet.getArray("key");
    Validate.isTrue(!resultSet.wasNull(), "Match group identifier must not be null");
    Validate.isTrue(sqlKey.getBaseType() == Types.BIGINT,
            "Key in database must be from the type \"bigint\" but was \"" + sqlKey.getBaseTypeName() + "\"");

    List<Long> key = Arrays.asList((Long[]) sqlKey.getArray());

    return new AnnotatedSpan(id, coveredText, annotations, metaData, key);
}

From source file:com.surveypanel.dao.FormRowHandler.java

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
    FormDTO formDTO = new FormDTO();
    formDTO.setId(rs.getString("id"));
    formDTO.setSurveyId(rs.getLong("surveyId"));
    formDTO.setQualified(rs.getBoolean("qualified"));
    formDTO.setFinish(rs.getBoolean("finish"));
    formDTO.setUpdated(rs.getDate("updated"));
    formDTO.setCreated(rs.getDate("created"));
    formDTO.setVariables(StateRowMapper.getMap(rs.getBlob("js_data")));
    formDTO.setXmlContent(rs.getString("xml_data"));
    return formDTO;
}

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

private static final void loadItems(AuctionMarkProfile profile, ResultSet vt) throws SQLException {
    int ctr = 0;/*from www .  j a  va 2  s. com*/
    while (vt.next()) {
        int col = 1;
        ItemId i_id = new ItemId(vt.getLong(col++));
        double i_current_price = vt.getDouble(col++);
        Timestamp i_end_date = vt.getTimestamp(col++);
        int i_num_bids = (int) vt.getLong(col++);

        // IMPORTANT: Do not set the status here so that we make sure that
        // it is added to the right queue
        ItemInfo itemInfo = new ItemInfo(i_id, i_current_price, i_end_date, i_num_bids);
        profile.addItemToProperQueue(itemInfo, false);
        ctr++;
    } // WHILE

    if (LOG.isDebugEnabled())
        LOG.debug(String.format("Loaded %d records from %s", ctr, AuctionMarkConstants.TABLENAME_ITEM));
}