| 63 | |
| 64 | // 사용자 정보를 user_info테이블에 저장하는 메서드 |
| 65 | @Override |
| 66 | public int insertUser(User user) throws Exception { |
| 67 | int rowCnt = 0; |
| 68 | String sql = "INSERT INTO user_info VALUES (?,?,?,?,?,?, now()) "; |
| 69 | |
| 70 | try( |
| 71 | Connection conn = ds.getConnection(); |
| 72 | PreparedStatement pstmt = conn.prepareStatement(sql); // SQL Injection공격, 성능향상 |
| 73 | ){ |
| 74 | pstmt.setString(1, user.getId()); |
| 75 | pstmt.setString(2, user.getPwd()); |
| 76 | pstmt.setString(3, user.getName()); |
| 77 | pstmt.setString(4, user.getEmail()); |
| 78 | pstmt.setDate(5, new java.sql.Date(user.getBirth().getTime())); |
| 79 | pstmt.setString(6, user.getSns()); |
| 80 | |
| 81 | return pstmt.executeUpdate(); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public int updateUser(User user) throws Exception { |