//-----------------------------------------------------------------------------
void
QGCCacheWorker::_deleteTileSet(QGCMapTask* mtask)
{
    if(!_testTask(mtask)) {
        return;
    }
    QGCDeleteTileSetTask* task = static_cast<QGCDeleteTileSetTask*>(mtask);
    _deleteTileSet(task->setID());
    task->setTileSetDeleted();
}
//-----------------------------------------------------------------------------
void
QGCCacheWorker::_deleteTileSet(QGCMapTask* mtask)
{
    if(!_valid) {
        mtask->setError("No Cache Database");
        return;
    }
    QGCDeleteTileSetTask* task = static_cast<QGCDeleteTileSetTask*>(mtask);
    QSqlQuery query(*_db);
    QString s;
    s = QString("DELETE FROM Tiles WHERE tileID IN (SELECT tileID FROM SetTiles WHERE setID = %1)").arg(task->setID());
    query.exec(s);
    s = QString("DELETE FROM TilesDownload WHERE setID = %1").arg(task->setID());
    query.exec(s);
    s = QString("DELETE FROM TileSets WHERE setID = %1").arg(task->setID());
    query.exec(s);
    s = QString("DELETE FROM SetTiles WHERE setID = %1").arg(task->setID());
    query.exec(s);
    _updateTotals();
    task->setTileSetDeleted();
}