From 3c4149bd30c796482559385dd9e2cffdf47cc71a Mon Sep 17 00:00:00 2001 From: mjw11 <mjw11@illinois.edu> Date: Wed, 18 Nov 2020 23:46:18 -0600 Subject: [PATCH] create activatePatient function in DAO --- .../ncsu/csc/itrust/dao/mysql/PatientDAO.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java index 7314e60..3780533 100644 --- a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java +++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java @@ -190,6 +190,22 @@ public class PatientDAO { } } + public void activatePatient(long mid) throws DBException { + Connection conn = null; + PreparedStatement ps = null; + try { + conn = factory.getConnection(); + ps = conn.prepareStatement("UPDATE users SET role=? WHERE MID=?"); + ps.setString(1, "patient") + ps.setLong(2, mid); + + } catch (SQLException e) { + throw new DBException(e); + } finally { + DBUtil.closeConnection(conn, ps); + } + } + /** * Updates a patient's information for the given MID * -- GitLab