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:org.satic.persistence.pojo.DAO.rowMapper.GradoRowMapper.java

@Override
public Grado mapRow(ResultSet rs, int i) throws SQLException {
    Grado g = new Grado();
    g.setIdGrado(rs.getInt("id_grado"));
    g.setNombre(rs.getString("nombre"));
    g.setDescripcion(rs.getString("descripcion"));
    return g;//w w w.  ja va  2  s. c o m
}

From source file:com.uit.anonymousidentity.Repository.Nonces.NonceMapper.java

@Override
public Nonce mapRow(ResultSet rs, int i) throws SQLException {
    Nonce nonce = new Nonce();
    nonce.setId(rs.getInt(NonceJDBCTemplate.ID));
    nonce.setIssuerSid(rs.getString(NonceJDBCTemplate.SID));
    return nonce;
}

From source file:entity.KategoriMapper.java

@Override
public Kategori mapRow(ResultSet rs, int i) throws SQLException {
    Kategori temp = new Kategori();
    temp.setId(rs.getInt("id"));
    temp.setKode(rs.getString("kode"));
    temp.setNama(rs.getString("nama"));
    return temp;//from   w w w.j av a 2  s .com
}

From source file:org.osmsurround.ae.dao.NodeValueResultMappingSqlQuery.java

@Override
protected NodeValueResult mapRow(ResultSet rs, int rowNum) throws SQLException {
    return new NodeValueResult(rs.getString(1), rs.getInt(2));
}

From source file:at.alladin.rmbt.db.fields.IntField.java

@Override
public void setField(final ResultSet rs) throws SQLException {
    value = rs.getInt(dbKey);
    if (rs.wasNull())
        value = null;// w  w  w. ja va 2 s  .co  m
}

From source file:com.l2jfree.gameserver.model.entity.events.DM.java

public static void loadData() {
    _eventName = "";
    _eventDesc = "";
    _joiningLocationName = "";
    _savePlayers = new CopyOnWriteArrayList<String>();
    _players = new CopyOnWriteArrayList<L2Player>();
    _topPlayer = null;/*  www.j  av  a 2s .  c  o  m*/
    _npcSpawn = null;
    _joining = false;
    _teleport = false;
    _started = false;
    _sitForced = false;
    _npcId = 0;
    _npcX = 0;
    _npcY = 0;
    _npcZ = 0;
    _rewardId = 0;
    _rewardAmount = 0;
    _topKills = 0;
    _minlvl = 0;
    _maxlvl = 0;
    _playerColors = 0;
    _playerX = 0;
    _playerY = 0;
    _playerZ = 0;

    Connection con = null;
    try {
        PreparedStatement statement;
        ResultSet rs;

        con = L2DatabaseFactory.getInstance().getConnection(con);

        statement = con.prepareStatement("Select * from dm");
        rs = statement.executeQuery();

        while (rs.next()) {
            _eventName = rs.getString("eventName");
            _eventDesc = rs.getString("eventDesc");
            _joiningLocationName = rs.getString("joiningLocation");
            _minlvl = rs.getInt("minlvl");
            _maxlvl = rs.getInt("maxlvl");
            _npcId = rs.getInt("npcId");
            _npcX = rs.getInt("npcX");
            _npcY = rs.getInt("npcY");
            _npcZ = rs.getInt("npcZ");
            _rewardId = rs.getInt("rewardId");
            _rewardAmount = rs.getInt("rewardAmount");
            _playerColors = rs.getInt("color");
            _playerX = rs.getInt("playerX");
            _playerY = rs.getInt("playerY");
            _playerZ = rs.getInt("playerZ");

        }
        statement.close();
    } catch (Exception e) {
        _log.error("Exception: DM.loadData(): ", e);
    } finally {
        L2DatabaseFactory.close(con);
    }
}

From source file:dao.SchemaDatasetRowMapper.java

@Override
public SchemaDataset mapRow(ResultSet rs, int rowNum) throws SQLException {
    int id = rs.getInt(DATASET_ID_COLUMN);
    String urn = rs.getString(URN_COLUMN);
    String name = "";
    if (StringUtils.isNotBlank(urn)) {
        int index = urn.lastIndexOf('/');
        if (index != -1) {
            name = urn.substring(index + 1);
        }//from  w  w w . jav  a 2s  .  co  m
    }
    String modified = rs.getString(MODIFIED_DATE_COLUMN);

    SchemaDataset schemaDataset = new SchemaDataset();
    schemaDataset.id = id;
    schemaDataset.urn = urn;
    schemaDataset.lastModified = modified;
    schemaDataset.name = name;
    schemaDataset.datasetLink = DATASET_LINK_PREFIX + id;
    return schemaDataset;
}

From source file:dk.netarkivet.common.utils.DBUtils.java

/**
 * Get an Integer from the resultSet in column i.
 * @param rs the resultset//from  w ww.j  a  va2  s  . c om
 * @param i the column where the wanted Integer resides
 * @return an Integer object located in column i in the resultset
 * @throws SQLException If the columnIndex is not valid, or a database
 * access error occurs or this method is called on a closed result set
 */
public static Integer getIntegerMaybeNull(ResultSet rs, int i) throws SQLException {
    ArgumentNotValid.checkNotNull(rs, "ResultSet rs");
    Integer res = rs.getInt(i);
    if (rs.wasNull()) {
        return null;
    }
    return res;
}

From source file:database.StudentMapper.java

public Student mapRow(ResultSet rs, int rowNum) throws SQLException {
    Student student = new Student();
    student.setId(rs.getInt("id"));
    student.setName(rs.getString("name"));
    student.setAge(rs.getInt("age"));
    return student;
}

From source file:ar.com.springbasic.beans.AdminRowMapper.java

@Override
public Admin mapRow(ResultSet rs, int i) throws SQLException {
    Admin admin = new Admin();

    admin.setIdAd(rs.getInt("idAd"));
    admin.setCargo(rs.getString("cargo"));
    admin.setFechaCreacion(rs.getTimestamp("fechaCreacion"));
    admin.setNombre(rs.getString("nombre"));

    return admin;
}