Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Database::deleteMovie(const QString &title, const QString &releaseDate)
- {
- // TODO: Delete other tables related to movie (e.g. genres etc).
- QSqlQuery query1("SELECT ID FROM MOVIE WHERE TITLE = :title AND RELEASEDATE = :releaseDate;");
- int result = query1.record().value(0).toInt();
- QSqlQuery queryLoc("DELETE FROM LOCATE WHERE ID = :id;");
- query.bindValue(":id", result);
- query.exec();
- QSqlQuery queryCat("DELETE FROM CATEGORISE WHERE ID = :id;");
- query.bindValue(":id", result);
- query.exec();
- QSqlQuery queryDir("DELETE FROM DIRECT WHERE ID = :id;");
- query.bindValue(":id", result);
- query.exec();
- QSqlQuery queryDes("DELETE FROM DESCRIBE WHERE ID = :id;");
- query.bindValue(":id", result);
- query.exec();
- QSqlQuery query("DELETE FROM MOVIE WHERE TITLE = :title AND RELEASEDATE = :releaseDate;");
- query.bindValue(":title", title);
- query.bindValue(":releaseDate", releaseDate);
- return query.exec();
- }
Add Comment
Please, Sign In to add comment