List of usage examples for java.sql ResultSet updateRow
void updateRow() throws SQLException;
ResultSet
object. From source file:org.zanata.liquibase.custom.MigrateHTermCommentToString.java
@Override public void execute(Database database) throws CustomChangeException { final JdbcConnection conn = (JdbcConnection) database.getConnection(); try (Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)) { Map<Long, String> termCommentsMap = new HashMap<Long, String>(); ResultSet rs1 = null;//from w ww .ja va2 s.c o m ResultSet rs2 = null; try { String termCommentsSql = "select term.id, comment.comment from " + "HGlossaryTerm as term, HTermComment as comment where comment.glossaryTermId = term.id"; rs1 = stmt.executeQuery(termCommentsSql); while (rs1.next()) { long termId = rs1.getLong(1); String comment = rs1.getString(2); String newComment = null; if (termCommentsMap.containsKey(termId)) { newComment = joinComment(termCommentsMap.get(termId), comment); } else { newComment = joinComment(null, comment); } termCommentsMap.put(termId, newComment); } String termSql = "select term.id, term.comment from HGlossaryTerm term"; rs2 = stmt.executeQuery(termSql); while (rs2.next()) { long termId = rs2.getLong(1); String comment = termCommentsMap.get(termId); rs2.updateString(2, comment); rs2.updateRow(); } } finally { rs1.close(); rs2.close(); } } catch (SQLException | DatabaseException e) { throw new CustomChangeException(e); } }
From source file:oscar.form.FrmRecordHelp.java
public void updateFormRecord(Properties props, String sql) throws SQLException { ResultSet rs = DBHandler.GetSQL(sql, true); //rs.relative(0); rs = updateResultSet(props, rs, false); rs.updateRow(); rs.close();//from w w w .j a va 2 s. c o m }