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:41:06 +0200
commit42ea21ec794c381558738e7eb87bae309d3a376e (patch)
treea64d597a37e14fd8943a08802fcb1f9a8be2f5a5
parent670fb5bcc1f1e10644803af130cb2511a46cb7c9 (diff)
downloadaudiomanager-42ea21ec794c381558738e7eb87bae309d3a376e.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);