diff options
Diffstat (limited to 'AudioManagerDaemon/src/CAmDatabaseHandler.cpp')
-rw-r--r-- | AudioManagerDaemon/src/CAmDatabaseHandler.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp index e4e0bff..2110780 100644 --- a/AudioManagerDaemon/src/CAmDatabaseHandler.cpp +++ b/AudioManagerDaemon/src/CAmDatabaseHandler.cpp @@ -1248,16 +1248,19 @@ am_Error_e CAmDatabaseHandler::removeSinkDB(const am_sinkID_t sinkID) std::string command = "DELETE from " + std::string(SINK_TABLE) + " WHERE sinkID=" + i2s(sinkID); std::string command1 = "DROP table SinkConnectionFormat" + i2s(sinkID); - std::string command2 = "DROP table SinkMainSoundProperty" + i2s(sinkID); - std::string command3 = "DROP table SinkSoundProperty" + i2s(sinkID); + std::string command2 = "DROP table SinkSoundProperty" + i2s(sinkID); + std::string command3 = "DROP table SinkMainSoundProperty" + i2s(sinkID); if (!sqQuery(command)) return (E_DATABASE_ERROR); if (!sqQuery(command1)) return (E_DATABASE_ERROR); if (!sqQuery(command2)) return (E_DATABASE_ERROR); - if (!sqQuery(command3)) - return (E_DATABASE_ERROR); + if (visible) //only drop table if it ever existed + { + if (!sqQuery(command3)) + return (E_DATABASE_ERROR); + } logInfo("DatabaseHandler::removeSinkDB removed:", sinkID); if (mpDatabaseObserver != NULL) @@ -1287,8 +1290,12 @@ am_Error_e CAmDatabaseHandler::removeSourceDB(const am_sourceID_t sourceID) return (E_DATABASE_ERROR); if (!sqQuery(command2)) return (E_DATABASE_ERROR); - if (!sqQuery(command3)) - return (E_DATABASE_ERROR); + + if(visible) + { + if (!sqQuery(command3)) + return (E_DATABASE_ERROR); + } logInfo("DatabaseHandler::removeSourceDB removed:", sourceID); if (mpDatabaseObserver) mpDatabaseObserver->removedSource(sourceID, visible); |