MCPcopy Index your code
hub / github.com/Krishna18062005/Hospital_Management_System_Java / addPatient

Method addPatient

PatientDAO.java:6–17  ·  view source on GitHub ↗
(Patient patient)

Source from the content-addressed store, hash-verified

4
5public class PatientDAO {
6 public void addPatient(Patient patient) throws SQLException {
7 Connection conn = DatabaseConnection.getConnection();
8 String query = "INSERT INTO patients (id, name, age, gender) VALUES (?, ?, ?, ?)";
9 PreparedStatement stmt = conn.prepareStatement(query);
10 stmt.setInt(1, patient.getId());
11 stmt.setString(2, patient.getName());
12 stmt.setInt(3, patient.getAge());
13 stmt.setString(4, patient.getGender());
14 stmt.executeUpdate();
15 stmt.close();
16 conn.close();
17 }
18}

Callers 1

mainMethod · 0.95

Calls 5

getConnectionMethod · 0.95
getAgeMethod · 0.80
getGenderMethod · 0.80
getIdMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected