给注册用户添加了个默认name
This commit is contained in:
parent
8722fb89ed
commit
82a234f546
@ -127,11 +127,12 @@ public class DatabaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerUser(String username, String password) throws SQLException {
|
public void registerUser(String username, String password) throws SQLException {
|
||||||
String sql = "INSERT INTO users (username, password) VALUES (?, ?)";
|
String sql = "INSERT INTO users (username, password, name) VALUES (?, ?, ?)";
|
||||||
try (Connection conn = getConnection();
|
try (Connection conn = getConnection();
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||||
stmt.setString(1, username);
|
stmt.setString(1, username);
|
||||||
stmt.setString(2, password);
|
stmt.setString(2, password);
|
||||||
|
stmt.setString(3, username);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user