MCPcopy Index your code
hub / github.com/castello/spring_basic / deleteUser

Method deleteUser

ch3/UserDaoImpl.java:17–42  ·  view source on GitHub ↗
(String id)

Source from the content-addressed store, hash-verified

15 final int FAIL = 0;
16
17 @Override
18 public int deleteUser(String id) {
19 int rowCnt = FAIL; // insert, delete, update
20
21 Connection conn = null;
22 PreparedStatement pstmt = null;
23
24 String sql = "delete from user_info where id= ? ";
25
26 try {
27 conn = ds.getConnection();
28 pstmt = conn.prepareStatement(sql);
29 pstmt.setString(1, id);
30// int rowCnt = pstmt.executeUpdate(); // insert, delete, update
31// return rowCnt;
32 return pstmt.executeUpdate(); // insert, delete, update
33 } catch (SQLException e) {
34 e.printStackTrace();
35 return FAIL;
36 } finally {
37 // close()를 호출하다가 예외가 발생할 수 있으므로, try-catch로 감싸야함.
38// try { if(pstmt!=null) pstmt.close(); } catch (SQLException e) { e.printStackTrace();}
39// try { if(conn!=null) conn.close(); } catch (SQLException e) { e.printStackTrace();}
40 close(pstmt, conn); // private void close(AutoCloseable... acs) {
41 }
42 }
43
44 @Override
45 public User selectUser(String id) throws Exception {

Callers

nothing calls this directly

Calls 1

closeMethod · 0.95

Tested by

no test coverage detected