| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public int updateUser(User user) throws Exception { |
| 87 | int rowCnt = 0; |
| 88 | |
| 89 | String sql = "UPDATE user_info " + |
| 90 | "SET pwd = ?, name=?, email=?, birth =?, sns=?, reg_date=? " + |
| 91 | "WHERE id = ? "; |
| 92 | |
| 93 | try ( |
| 94 | Connection conn = ds.getConnection(); |
| 95 | PreparedStatement pstmt = conn.prepareStatement(sql); |
| 96 | ){ |
| 97 | pstmt.setString(1, user.getPwd()); |
| 98 | pstmt.setString(2, user.getName()); |
| 99 | pstmt.setString(3, user.getEmail()); |
| 100 | pstmt.setDate(4, new java.sql.Date(user.getBirth().getTime())); |
| 101 | pstmt.setString(5, user.getSns()); |
| 102 | pstmt.setTimestamp(6, new java.sql.Timestamp(user.getReg_date().getTime())); |
| 103 | pstmt.setString(7, user.getId()); |
| 104 | |
| 105 | rowCnt = pstmt.executeUpdate(); |
| 106 | } |
| 107 | |
| 108 | return rowCnt; |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public int count() throws Exception { |