public void insertAtividade(Atividade atividade) throws SQLException { sql = "INSERT INTO atividade (NOME, DESCRICAO, USER_MODIF, AUTOR, STATUS)" + "VALUES(?,?,?,?,?)"; if (!FabricaConexoes.verificaConexao()) FabricaConexoes.getConexao(); stm = FabricaConexoes.returnStatement(sql); stm.setString(1, atividade.getNome()); stm.setString(2, atividade.getDescricao()); stm.setInt(3, atividade.getUserModif()); stm.setInt(4, atividade.getAutor()); stm.setInt(5, atividade.getStatus()); stm.execute(); stm.close(); FabricaConexoes.closeConnection(); }
public void updateAtividade(Atividade atividade) throws SQLException { sql = "UPDATE atividade SET nome = ?, descricao = ?, user_modif = ?, status = ? WHERE idatividade = ? "; if (!FabricaConexoes.verificaConexao()) FabricaConexoes.getConexao(); stm = FabricaConexoes.returnStatement(sql); stm.setString(1, atividade.getNome()); stm.setString(2, atividade.getDescricao()); stm.setInt(3, atividade.getUserModif()); stm.setInt(4, atividade.getStatus()); stm.setInt(5, atividade.getId()); stm.execute(); stm.close(); FabricaConexoes.closeConnection(); }