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

Method selectUser

ch3/DBConnectionTest2Test.java:80–101  ·  view source on GitHub ↗
(String id)

Source from the content-addressed store, hash-verified

78 }
79
80 public User selectUser(String id) throws Exception {
81 Connection conn = ds.getConnection();
82
83 String sql = "select * from user_info where id= ? ";
84
85 PreparedStatement pstmt = conn.prepareStatement(sql); // SQL Injection공격, 성능향상
86 pstmt.setString(1,id);
87 ResultSet rs = pstmt.executeQuery(); // select
88
89 if(rs.next()) {
90 User user = new User();
91 user.setId(rs.getString(1));
92 user.setPwd(rs.getString(2));
93 user.setName(rs.getString(3));
94 user.setEmail(rs.getString(4));
95 user.setBirth(new Date(rs.getDate(5).getTime()));
96 user.setSns(rs.getString(6));
97 user.setReg_date(new Date(rs.getTimestamp(7).getTime()));
98 return user;
99 }
100 return null;
101 }
102
103 private void deleteAll() throws Exception {
104 Connection conn = ds.getConnection();

Callers 2

selectUserTestMethod · 0.95
deleteUserTestMethod · 0.95

Calls 7

setIdMethod · 0.95
setPwdMethod · 0.95
setNameMethod · 0.95
setEmailMethod · 0.95
setBirthMethod · 0.95
setSnsMethod · 0.95
setReg_dateMethod · 0.95

Tested by

no test coverage detected