modify msg-service to support dpm feature
[platform/core/messaging/msg-service.git] / framework / storage-handler / MsgStorageManager.cpp
index 2c5f9cd..c8e31b1 100755 (executable)
@@ -34,7 +34,7 @@
 #include "MsgPluginManager.h"
 #include "MsgStorageHandler.h"
 
-#define MSG_DB_VERSION 1
+#define MSG_DB_VERSION 2
 
 /*==================================================================================================
                                      VARIABLES
@@ -99,6 +99,25 @@ void MsgUpdateDBtoVer1()
 }
 
 
+void MsgUpdateDBtoVer2()
+{
+       MsgDbHandler *dbHandle = getDbHandle();
+       msg_error_t err = MSG_SUCCESS;
+       char sqlQuery[MAX_QUERY_LEN+1] = {0};
+       snprintf(sqlQuery, sizeof(sqlQuery),
+                       "ALTER TABLE %s "
+                       "ADD (DPM_RESTRICTED INTEGER DEFAULT 0);",
+                       MSGFW_MESSAGE_TABLE_NAME);
+
+       err = dbHandle->execQuery(sqlQuery);
+
+       if (err == MSG_SUCCESS)
+               MSG_SEC_DEBUG("SUCCESS : alter %s.", MSGFW_MESSAGE_TABLE_NAME);
+       else
+               MSG_SEC_DEBUG("FAIL : create %s [%d].", MSGFW_MESSAGE_TABLE_NAME, err);
+}
+
+
 void MsgStoUpdateDBVersion()
 {
        MsgDbHandler *dbHandle = getDbHandle();
@@ -150,6 +169,9 @@ msg_error_t MsgStoDBVerCheck()
        case 0 :
                MsgUpdateDBtoVer1();
                /* no break */
+       case 1 :
+               MsgUpdateDBtoVer2();
+               /* no break */
        default :
                MsgStoUpdateDBVersion();
                /* no break */