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:Notification_Manager.Notification_Mapper.java
@Override public Notification mapRow(ResultSet rs, int rowNum) throws SQLException { Notification notification = new Notification(); notification.setNid(rs.getInt("nid")); notification.setUid(rs.getInt("uid")); notification.setLink(rs.getString("link")); notification.setNotification(rs.getString("notification")); notification.setTs(rs.getString("ts")); notification.setChecked(rs.getShort("checked")); return notification; }
From source file:org.apache.niolex.config.dao.impl.ConfigGroupRowMapper.java
/** * Override super method//from w w w . ja v a2 s . com * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) */ @Override public ConfigGroup mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigGroup config = new ConfigGroup(); config.setGroupId(rs.getInt("groupid")); config.setGroupName(rs.getString("groupname")); return config; }
From source file:e_wallet.TransactionsMapper.java
@Override public Transactions mapRow(ResultSet rs, int rowNum) throws SQLException { Transactions transaction = new Transactions(); transaction.setId(rs.getInt("id")); transaction.setFrom(rs.getString("fromID")); transaction.setTo(rs.getString("toID")); transaction.setAmount(rs.getDouble("amount")); transaction.setStart(rs.getString("start")); transaction.setEnd(rs.getString("end")); transaction.setType(rs.getInt("type")); transaction.setBalance(rs.getDouble("balance")); transaction.setComments(rs.getString("comments")); transaction.setCompletion(rs.getInt("completion")); return transaction; }
From source file:com.dai.jdbc.SelecaoTreinoExtractor.java
public SelecaoTreino extractData(ResultSet resultSet) throws SQLException, DataAccessException { SelecaoTreino st = new SelecaoTreino(); st.setIdUtilizador(resultSet.getInt("utilizador_idutilizador_st")); st.setIdTreino(resultSet.getInt("treino_idtreino")); st.setPresenca(resultSet.getBoolean("presenca")); st.setNome(resultSet.getString("nomeUtilizador_t")); return st;//ww w .java 2 s . co m }
From source file:com.springapp.mvc.mappers.PriceRowMapper.java
@Override public PriceRow mapRow(ResultSet resultSet, int i) throws SQLException { PriceRow priceRow = new PriceRow(); priceRow.setCode(resultSet.getInt("code")); priceRow.setAmount(resultSet.getDouble("amount")); priceRow.setStartDate(resultSet.getDate("startdate")); priceRow.setEndDate(resultSet.getDate("enddate")); priceRow.setCurrency(Currency.getInstance(resultSet.getString("currency"))); return priceRow; }
From source file:com.test.springmvc.springmvcproject.mapper.UtilisateurMapper.java
@Override public UtilisateurBean mapRow(ResultSet rs, int i) throws SQLException { final UtilisateurBean utilisateur = new UtilisateurBean(); utilisateur.setId(rs.getInt("id")); utilisateur.setUsertag(rs.getString("usertag")); utilisateur.setEmail(rs.getString("email")); utilisateur.setPassword(rs.getString("password")); return utilisateur; }
From source file:edu.ku.brc.specify.conversion.ConvertMiscData.java
/** * @param oldDBConn//from w ww.ja v a 2s . c o m * @param newDBConn * @param disciplineID * @return */ public static boolean convertKUFishObsData(final Connection oldDBConn, final Connection newDBConn) { IdMapperMgr.getInstance().setDBs(oldDBConn, newDBConn); IdMapperIFace coMapper = IdMapperMgr.getInstance().addTableMapper("collectionobjectcatalog", "CollectionObjectCatalogID", false); PreparedStatement pStmt1 = null; PreparedStatement pStmt2 = null; PreparedStatement pStmt3 = null; try { pStmt1 = newDBConn.prepareStatement( "INSERT INTO collectionobjectattribute (Remarks, CollectionMemberID, TimestampCreated, TimestampModified, Version) VALUES(?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS); pStmt2 = newDBConn.prepareStatement( "UPDATE collectionobjectattribute SET Remarks=? WHERE CollectionObjectAttributeID = ?"); pStmt3 = newDBConn.prepareStatement( "UPDATE collectionobject SET CollectionObjectAttributeID=? WHERE CollectionObjectID = ?"); String sql = " SELECT BiologicalObjectID, Text1, TimestampCreated, TimestampModified FROM observation WHERE Text1 IS NOT NULL AND LENGTH(Text1) > 0"; Statement stmt = oldDBConn.createStatement(); ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { int oldCOId = rs.getInt(1); Integer newCOId = coMapper.get(oldCOId); if (newCOId != null) { sql = "SELECT CollectionObjectAttributeID, CollectionMemberID FROM collectionobject WHERE CollectionObjectID = " + newCOId; Object[] row = BasicSQLUtils.getRow(sql); if (row == null || row.length == 0) { log.error("Couldn't get record for newCOId " + newCOId); continue; } Integer newCOAId = (Integer) row[0]; Integer collMemId = (Integer) row[1]; if (newCOAId != null) // Do Update { pStmt2.setString(1, rs.getString(2)); pStmt2.setInt(2, newCOAId); pStmt2.executeUpdate(); } else // Do Insert { pStmt1.setString(1, rs.getString(2)); pStmt1.setInt(2, collMemId); pStmt1.setTimestamp(3, rs.getTimestamp(3)); pStmt1.setTimestamp(4, rs.getTimestamp(4)); pStmt1.setInt(5, 1); pStmt1.executeUpdate(); newCOAId = BasicSQLUtils.getInsertedId(pStmt1); } pStmt3.setInt(1, newCOAId); pStmt3.setInt(2, newCOId); pStmt3.executeUpdate(); } else { log.error("No mapped CO for Obs.BiologicalObjectID " + oldCOId); } } rs.close(); stmt.close(); return true; } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (pStmt1 != null) pStmt1.close(); if (pStmt2 != null) pStmt2.close(); if (pStmt3 != null) pStmt3.close(); } catch (Exception ex) { } } return false; }
From source file:edu.pitt.sis.infsci2730.finalProject.utils.CustomerRowMapper.java
public CustomerDBModel mapRow(ResultSet rs, int index) throws SQLException { CustomerDBModel customer = new CustomerDBModel(); customer.setCustomer_id(rs.getInt("CUSTOMER_ID")); customer.setAddress_id(rs.getInt("ADDRESS_ID")); customer.setCustomer_name(rs.getString("CUSTOMER_NAME")); customer.setGender(rs.getString("gender")); customer.setIncome(rs.getString("income")); customer.setAge(rs.getString("age")); return customer; }
From source file:com.dai.jdbc.TreinoExtractor.java
public Treino extractData(ResultSet resultSet) throws SQLException, DataAccessException { Treino treino = new Treino(); treino.setIdTreino(resultSet.getInt("idTreino")); treino.setDuracaoTreino(resultSet.getInt("duracaoTreino")); treino.setLocalTreino(resultSet.getString("localTreino")); treino.setDataTreino(resultSet.getString("dataTreino")); treino.setTipoTreino(resultSet.getString("tipoTreino")); treino.setHoraTreino(resultSet.getString("horaTreino")); treino.setIdEscalao(resultSet.getInt("escalao_idEscalao_t")); return treino; }
From source file:edu.pitt.sis.infsci2730.finalProject.utils.EmployeeRowMapper.java
public EmployeeDBModel mapRow(ResultSet rs, int index) throws SQLException { EmployeeDBModel employee = new EmployeeDBModel(); employee.setEmployee_id(rs.getInt("employee_id")); employee.setEmployee_name(rs.getString("employee_name")); employee.setAddress_id(rs.getInt("address_id")); employee.setStore_id(rs.getInt("store_id")); employee.setSalary(rs.getString("salary")); employee.setJobtitle(rs.getString("JOBTITLE")); return employee; }