给注册用户添加了个默认name

This commit is contained in:
高子兴 2024-07-14 16:26:41 +08:00
parent 8722fb89ed
commit 82a234f546

View File

@ -127,11 +127,12 @@ public class DatabaseService {
}
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();
PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, username);
stmt.setString(2, password);
stmt.setString(3, username);
stmt.executeUpdate();
}
}