summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian linke <christian.linke@bmw.de>2012-10-02 12:41:06 +0200
committerchristian linke <christian.linke@bmw.de>2012-10-02 12:55:31 +0200
commite1626b205f6199d6e4ea1e7167ba9c0b865d2ba6 (patch)
tree676668cbc6c773d683b704c0dda8621ceaa193b2
parent7167b48fe6787fad86cdacfc6d5a4aa322eea006 (diff)
downloadaudiomanager-e1626b205f6199d6e4ea1e7167ba9c0b865d2ba6.tar.gz
* [GAM-100] nonexisting tables are dropped
Signed-off-by: christian linke <christian.linke@bmw.de>
-rw-r--r--AudioManagerDaemon/src/CAmDatabaseHandler.cpp19
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);