Example usage for java.sql ResultSet getFloat

List of usage examples for java.sql ResultSet getFloat

Introduction

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

Prototype

float getFloat(String columnLabel) throws SQLException;

Source Link

Document

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

Usage

From source file:dao.ScriptRuntimeRowMapper.java

@Override
public ScriptRuntime mapRow(ResultSet rs, int rowNum) throws SQLException {
    String started = rs.getString(JOB_STARTED_COLUMN);
    Float elapsedTime = rs.getFloat(ELAPSED_TIME_COLUMN);
    String flowPath = rs.getString(FLOW_PATH_COLUMN);
    String jobName = rs.getString(JOB_NAME_COLUMN);

    ScriptRuntime runtime = new ScriptRuntime();
    runtime.jobStarted = started;/*w  w  w.  jav a2 s. c om*/
    runtime.elapsedTime = elapsedTime;
    if (StringUtils.isNotBlank(flowPath)) {
        int index = flowPath.indexOf(':');
        if (index != -1) {
            flowPath = "/" + flowPath.substring(index + 1);
        }
    }
    runtime.jobPath = flowPath + "/" + jobName;

    return runtime;
}

From source file:org.silverpeas.components.projectmanager.model.ProjectManagerDAO.java

private static TaskDetail getTaskDetailFromResultset(ResultSet rs) throws SQLException {
    int id = rs.getInt("id");
    int mereId = rs.getInt("mereId");
    int chrono = rs.getInt("chrono");
    String nom = rs.getString("nom");
    String description = rs.getString("description");
    int organisateurId = rs.getInt("organisateurId");
    int responsableId = rs.getInt("responsableId");
    float charge = rs.getFloat("charge");
    float consomme = rs.getFloat("consomme");
    float raf = rs.getFloat("raf");
    int statut = rs.getInt("statut");
    Date dateDebut = dbDate2Date(rs.getString("dateDebut"), "dateDebut");
    Date dateFin = dbDate2Date(rs.getString("dateFin"), "dateFin");
    String codeProjet = rs.getString("codeProjet");
    String descriptionProjet = rs.getString("descriptionProjet");
    int estDecomposee = rs.getInt("estDecomposee");
    String instanceId = rs.getString("instanceId");
    String path = rs.getString("path");
    int previousId = rs.getInt("previousId");

    TaskDetail task = new TaskDetail(id, mereId, chrono, nom, description, organisateurId, responsableId,
            charge, consomme, raf, statut, dateDebut, dateFin, codeProjet, descriptionProjet, estDecomposee,
            instanceId, path);/*from w w w .  j ava 2  s. c om*/
    task.setPreviousTaskId(previousId);
    return task;
}

From source file:com.apress.prospringintegration.springenterprise.stocks.dao.jdbc.StockMapper.java

public Stock mapRow(ResultSet rs, int rowNum) throws SQLException {
    Stock stock = new Stock(rs.getString("SYMBOL"), rs.getString("INVENTORY_CODE"), rs.getString("EXCHANGE_ID"),
            rs.getFloat("PRICE_PER_SHARE"), rs.getInt("QUANTITY_AVAILABLE"), rs.getDate("PURCHASE_DATE"));

    stock.setId(rs.getInt("ID"));
    return stock;
}

From source file:database.ExerciseMapper.java

@Override
public Exercise mapRow(ResultSet rs, int rowNum) throws SQLException {
    Exercise exercise = new Exercise();
    exercise.setId(rs.getInt("id"));
    exercise.setDate(rs.getDate("date"));
    exercise.setHours(rs.getFloat("hours"));
    exercise.setUserid(rs.getInt("userid"));
    return exercise;
}

From source file:io.kahu.hawaii.util.spring.AbstractDBRepository.java

protected Float getFloat(final ResultSet rs, final int columnIndex) throws SQLException {
    float result = rs.getFloat(columnIndex);
    return rs.wasNull() ? null : result;
}

From source file:io.kahu.hawaii.util.spring.AbstractDBRepository.java

protected Float getFloat(final ResultSet rs, final String columnLabel) throws SQLException {
    float result = rs.getFloat(columnLabel);
    return rs.wasNull() ? null : result;
}

From source file:org.arkanos.aos.api.data.Work.java

/**
 * Fetches all work entries from a user.
 * //from w w w. j  av a  2 s . com
 * @param user_name
 *            defines the user.
 * @return all work entries or null, in case there are connection problems.
 */
static public Vector<Work> getUserWorklog(String user_name) {
    try {
        ResultSet rs = Database.query("SELECT " + Work.FIELD_TASK_ID + "," + Work.FIELD_RESULT + ","
                + Work.FIELD_COMMENT + "," + Work.FIELD_START + "," + Work.FIELD_TIME_SPENT + "," + "t."
                + Task.FIELD_NAME + " AS " + Work.EXTRA_TASK_NAME + "," + "g." + Goal.FIELD_TITLE + " AS "
                + Work.EXTRA_GOAL_TITLE + " FROM goal g " + "LEFT JOIN " + Task.TABLE_NAME + " t on t."
                + Task.FIELD_GOAL_ID + " = g." + Goal.FIELD_ID + " " + "LEFT JOIN " + Work.TABLE_NAME
                + " w ON t." + Task.FIELD_ID + " = w." + Work.FIELD_TASK_ID + " " + "WHERE g."
                + Goal.FIELD_USER_NAME + " = \"" + user_name + "\"" + " AND w." + Work.FIELD_TASK_ID
                + " IS NOT NULL " + " AND w." + Work.FIELD_START + " IS NOT NULL;");
        Vector<Work> results = new Vector<Work>();
        while ((rs != null) && rs.next()) {
            Work newone = new Work(rs.getString(Work.FIELD_START), rs.getInt(Work.FIELD_TASK_ID),
                    rs.getFloat(Work.FIELD_RESULT), rs.getString(Work.FIELD_COMMENT),
                    rs.getInt(Work.FIELD_TIME_SPENT));

            newone.setGoalTitle(rs.getString(Work.EXTRA_GOAL_TITLE));
            newone.setTaskName(rs.getString(Work.EXTRA_TASK_NAME));

            results.add(newone);

        }
        return results;
    } catch (SQLException e) {
        Log.error("Work", "Problems retrieving logged work for a user.");
        e.printStackTrace();
    }
    return null;
}

From source file:com.apress.prospringintegration.springenterprise.stocks.dao.jdbc.JdbcTemplateStockDao.java

@Override
public List<Stock> findAvailableStockBySymbol(String symbol) {
    String sql = " SELECT * from STOCKS" + " WHERE SYMBOL = ? order by PRICE_PER_SHARE";
    List<Stock> ret = jdbcTemplate.query(sql, new Object[] { symbol }, new RowMapper<Stock>() {
        public Stock mapRow(ResultSet rs, int rowNum) throws SQLException {
            Stock s = new Stock(rs.getString("SYMBOL"), rs.getString("INVENTORY_CODE"),
                    rs.getString("EXCHANGE_ID"), rs.getFloat("PRICE_PER_SHARE"),
                    rs.getInt("QUANTITY_AVAILABLE"), rs.getDate("PURCHASE_DATE"));
            return s;
        }//from www  .  j av  a 2  s  . c o m
    });

    return ret;
}

From source file:nbadb.DAO.PlayerMapper.java

@Override
public Player mapRow(ResultSet rs, int i) throws SQLException {
    Player player = new Player();
    player.setPlayerID(rs.getInt("PlayerID"));
    player.setPlayerName(rs.getString("PlayerName"));
    player.setActivePlayer(rs.getString("ActivePlayer"));
    player.setPPG(rs.getFloat("PPG"));
    player.setAPG(rs.getFloat("APG"));
    player.setRPG(rs.getFloat("RPG"));

    return player;
}

From source file:com.senior.g40.service.AccidentService.java

private void setAccident(ResultSet rs, Accident ac) throws SQLException {
    ac.setUserId(rs.getInt("userId"));
    ac.setDate(rs.getDate("date"));
    ac.setTime(rs.getString("time"));
    ac.setLatitude(rs.getFloat("latitude"));
    ac.setLongtitude(rs.getFloat("longtitude"));
    ac.setForceDetect(rs.getFloat("forceDetect"));
    ac.setSpeedDetect(rs.getFloat("speedDetect"));
    ac.setAccCode(rs.getString("accCode").charAt(0));
}