This is my school project. I am in chrage of eForum portion. I tried to delete a user and all the threads and replies by the deleted user will also be deleted.
public boolean deleteUser() {
boolean success = false;
DBController db = new DBController();
db.setUp("IT Innovation Project");
String sql = "DELETE FROM forumUsers where users_id = " + userID + "";
if (db.updateRequest(sql) == 1)
success = true;
db.terminate();
return success;
}
This method retrieve the value of the first column of table and stored it as userID. Then, it will execute the delete sql statement to delete certain user.
public boolean deleteThread() {
boolean success = false;
DBController db = new DBController();
db.setUp("IT Innovation Project");
String sql = "DELETE FROM forumTopics where topic_id = " + threadID
+ "";
if (db.updateRequest(sql) == 1)
success = true;
db.terminate();
return success;
}
As for this method, it will take the value of first column of another table which is showing all the threads and execute the delete sql statement.
However, after I deleted some user, the threads and replies by the deleted user is still storing in the database. I am currently using one user table and one thread table in database. Is there any way to like so called 'synchronize' both table? Is it the inner join ?
Thanks in advance.