List of usage examples for java.sql ResultSet getInt
int getInt(String columnLabel) throws SQLException;
ResultSet
object as an int
in the Java programming language. From source file:lydichris.smashbracket.persistence.EntrantMapper.java
@Override public Entrant mapRow(ResultSet rs, int rowNum) throws SQLException { Entrant entrant = new Entrant(rs.getString("uuid"), rs.getString("tag"), rs.getString("user_uuid"), rs.getString("tournament_uuid"), rs.getInt("seed")); return entrant; }
From source file:com.epam.repository.author.AuthorRepository.java
public Author findBySurname(final String surname) { return jdbcTemplate.queryForObject(FIND_AUTHORS_BY_SURNAME, new Object[] { surname }, new RowMapper<Author>() { public Author mapRow(ResultSet rs, int rowNum) throws SQLException { Author author = new Author(); author.setId(rs.getInt("ID")); author.setName(rs.getString("Name")); author.setSurname(surname); return author; }//from w w w.ja va 2 s.c om }); }
From source file:com.leapfrog.inventorymanagementsystem.dao.impl.PurchaseDAOImpl.java
@Override public Purchase getById(int id) throws SQLException, ClassNotFoundException { String sql = "SELECT * FROM tbl_purchase WHERE purchase_id =?"; return jdbcTemplate.queryForObject(sql, new Object[] { id }, new RowMapper<Purchase>() { @Override//from w w w . jav a 2 s . c o m public Purchase mapRow(ResultSet rs, int i) throws SQLException { Purchase p = new Purchase(); p.setId(rs.getInt("purchase_id")); p.setProductName(rs.getString("product_name")); p.setCostPrice(rs.getInt("cost_price")); p.setDiscount(rs.getBigDecimal("discount")); p.setQuantity(rs.getInt("quantity")); p.setTotalCost(rs.getInt("total_cost")); p.setSupplierId(rs.getInt("supplier_id")); p.setPurchaseDate(rs.getDate("purchase_date")); p.setPaymentMethod(rs.getString("payment_method")); p.setStatus(rs.getBoolean("status")); return p; } }); }
From source file:io.kahu.hawaii.util.spring.AbstractDBRepository.java
protected Integer getInteger(final ResultSet rs, final int columnIndex) throws SQLException { int result = rs.getInt(columnIndex); return rs.wasNull() ? null : result; }
From source file:tianci.pinao.dts.tasks.dao.impl.ConfigDaoImpl.java
@Override public Map<Integer, Config> getConfigs() { final Map<Integer, Config> configs = new HashMap<Integer, Config>(); getJdbcTemplate().query("select id, type, value, lastmod_time, lastmod_userid from " + SqlConstants.TABLE_CONFIG + " where isdel = ?", new Object[] { 0 }, new RowMapper<Config>() { @Override/*w w w . j av a 2 s .c o m*/ public Config mapRow(ResultSet rs, int index) throws SQLException { Config config = new Config(); config.setId(rs.getInt("id")); config.setType(rs.getInt("type")); config.setValue(rs.getLong("value")); Timestamp ts = rs.getTimestamp("lastmod_time"); if (ts != null) config.setLastModTime(new Date(ts.getTime())); config.setLastModUserid(rs.getInt("lastmod_userid")); configs.put(config.getType(), config); return config; } }); return configs; }
From source file:com.l2jfree.gameserver.datatables.ArmorSetsTable.java
private void loadData() { Connection con = null;// ww w .java 2s.co m try { con = L2DatabaseFactory.getInstance().getConnection(con); PreparedStatement statement = con.prepareStatement( "SELECT chest, legs, head, gloves, feet, skill, shield, shield_skill_id, enchant6skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield FROM armorsets"); ResultSet rset = statement.executeQuery(); while (rset.next()) { int chest = rset.getInt("chest"); int legs = rset.getInt("legs"); int head = rset.getInt("head"); int gloves = rset.getInt("gloves"); int feet = rset.getInt("feet"); String[] skills = rset.getString("skill").split(";"); int shield = rset.getInt("shield"); int shield_skill_id = rset.getInt("shield_skill_id"); int enchant6skill = rset.getInt("enchant6skill"); int mwork_legs = rset.getInt("mw_legs"); int mwork_head = rset.getInt("mw_head"); int mwork_gloves = rset.getInt("mw_gloves"); int mwork_feet = rset.getInt("mw_feet"); int mwork_shield = rset.getInt("mw_shield"); _armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skills, shield, shield_skill_id, enchant6skill, mwork_legs, mwork_head, mwork_gloves, mwork_feet, mwork_shield)); } rset.close(); statement.close(); } catch (Exception e) { _log.warn("Could not completely load armor sets!", e); } finally { L2DatabaseFactory.close(con); _log.info("ArmorSetsTable: Loaded " + _armorSets.size() + " armor sets."); } }
From source file:com.griddynamics.spring.batch.football.internal.PlayerSummaryRowMapper.java
public Object mapRow(ResultSet rs, int rowNum) throws SQLException { PlayerSummary summary = new PlayerSummary(); summary.setId(rs.getString(1));//from ww w .j a v a2 s .c om summary.setYear(rs.getInt(2)); summary.setCompletes(rs.getInt(3)); summary.setAttempts(rs.getInt(4)); summary.setPassingYards(rs.getInt(5)); summary.setPassingTd(rs.getInt(6)); summary.setInterceptions(rs.getInt(7)); summary.setRushes(rs.getInt(8)); summary.setRushYards(rs.getInt(9)); summary.setReceptions(rs.getInt(10)); summary.setReceptionYards(rs.getInt(11)); summary.setTotalTd(rs.getInt(12)); return summary; }
From source file:controladores.PeliculasController.java
public ModelAndView verMas(HttpServletRequest request, HttpServletResponse response) throws Exception { int pid = Integer.valueOf(request.getParameter("pid")); this.getConnection(request.getServletContext()); Pelicula p = null;/*from w w w . j av a2 s.co m*/ try { PreparedStatement ps = this.conexion.prepareStatement( "SELECT ids, nombre, observaciones, tipopeli, precio, foto FROM peliculas WHERE ids = ?"); ps.setInt(1, pid); ResultSet rs = ps.executeQuery(); if (rs.next()) { p = new Pelicula(rs.getInt("ids"), rs.getString("nombre"), rs.getString("tipopeli"), rs.getString("observaciones"), rs.getInt("precio"), rs.getString("foto").toUpperCase()); } rs.close(); } catch (SQLException ex) { ex.printStackTrace(); } ModelAndView mv; if (p != null) { mv = new ModelAndView("detalles"); mv.addObject("pelicula", p); } else { mv = this.inicio(request, response); } mv.addObject("metodo", "verMas"); return mv; }
From source file:com.beezas.dao.ContactExtractor.java
public Contact extractData(ResultSet resultSet) throws SQLException, DataAccessException { Contact contact = new Contact(); System.out.println("Hai this is contactextractor :"); contact.setId(resultSet.getInt(1)); contact.setMedianame(resultSet.getString(2)); contact.setContacttypename(resultSet.getString(3)); contact.setEmail(resultSet.getString(4)); contact.setEventDisplay(resultSet.getString(5)); contact.setFname(resultSet.getString(6)); contact.setLname(resultSet.getString(7)); contact.setContactemail(resultSet.getString(8)); contact.setPhonenumber(resultSet.getInt(9)); return contact; }