DeviceDatabaseBackend: Remove use of QSqlDatabase::exec()
This commit is contained in:
parent
c95295d8b4
commit
16b4f5d065
@ -161,19 +161,52 @@ void DeviceDatabaseBackend::RemoveDevice(const int id) {
|
|||||||
ScopedTransaction t(&db);
|
ScopedTransaction t(&db);
|
||||||
|
|
||||||
// Remove the device from the devices table
|
// Remove the device from the devices table
|
||||||
SqlQuery q(db);
|
{
|
||||||
q.prepare("DELETE FROM devices WHERE ROWID=:id");
|
SqlQuery q(db);
|
||||||
q.BindValue(":id", id);
|
q.prepare("DELETE FROM devices WHERE ROWID=:id");
|
||||||
if (!q.Exec()) {
|
q.BindValue(":id", id);
|
||||||
db_->ReportErrors(q);
|
if (!q.Exec()) {
|
||||||
return;
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the songs tables for the device
|
// Remove the songs tables for the device
|
||||||
db.exec(QString("DROP TABLE device_%1_songs").arg(id));
|
{
|
||||||
db.exec(QString("DROP TABLE device_%1_fts").arg(id));
|
SqlQuery q(db);
|
||||||
db.exec(QString("DROP TABLE device_%1_directories").arg(id));
|
q.prepare(QString("DROP TABLE device_%1_songs").arg(id));
|
||||||
db.exec(QString("DROP TABLE device_%1_subdirectories").arg(id));
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SqlQuery q(db);
|
||||||
|
q.prepare(QString("DROP TABLE device_%1_fts").arg(id));
|
||||||
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SqlQuery q(db);
|
||||||
|
q.prepare(QString("DROP TABLE device_%1_directories").arg(id));
|
||||||
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SqlQuery q(db);
|
||||||
|
q.prepare(QString("DROP TABLE device_%1_subdirectories").arg(id));
|
||||||
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
t.Commit();
|
t.Commit();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user