From dbdb7ade90d58ec34a3e2ac49020ab794ace3e80 Mon Sep 17 00:00:00 2001 From: Keebum Kim Date: Fri, 7 Jun 2013 17:30:00 +0900 Subject: [PATCH] Modify add message related. Change-Id: Ib221efe40a0c652d9c56e8a7abe1cdbc0b409bfb --- framework/storage-handler/MsgStorageMessage.cpp | 6 ++++-- framework/storage-handler/MsgStorageMms.cpp | 12 ------------ utils/MsgSqliteWrapper.cpp | 10 ---------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index ff8d5f1..e665654 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -167,8 +167,6 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS } } - dbHandle.endTrans(true); - /* In the case of MMS Message, load the MMS plugin to save MMS PDU */ if (pMsg->msgType.mainType == MSG_MMS_TYPE) { MMS_MESSAGE_DATA_S mmsMsg; @@ -180,6 +178,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS err = plg->addMessage(pMsg, pSendOptInfo, pFileData); if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); return MSG_ERR_STORAGE_ERROR; } @@ -189,12 +188,15 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS err = MsgStoUpdateMMSMessage(pMsg); if (err != MSG_SUCCESS) { + dbHandle.endTrans(false); return MSG_ERR_STORAGE_ERROR; } } } } + dbHandle.endTrans(true); + MSG_END(); return MSG_SUCCESS; diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp index 9009984..2b19b07 100755 --- a/framework/storage-handler/MsgStorageMms.cpp +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -74,8 +74,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) memset(sqlQuery, 0x00, sizeof(sqlQuery)); - dbHandle.beginTrans(); - if(pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS ) { snprintf(sqlQuery, sizeof(sqlQuery), @@ -83,7 +81,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); return MSG_ERR_DB_PREPARE; } @@ -95,7 +92,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->networkStatus, pMsg->thumbPath, pMsg->msgId); if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); return MSG_ERR_DB_PREPARE; } @@ -108,7 +104,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); return MSG_ERR_DB_PREPARE; } @@ -119,14 +114,12 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->msgId); if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle.endTrans(false); return MSG_ERR_DB_PREPARE; } } if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) { dbHandle.finalizeQuery(); - dbHandle.endTrans(false); MSG_DEBUG("Update MMS Message. Fail [%s]", sqlQuery); return MSG_ERR_DB_STEP; } @@ -143,7 +136,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if (dbHandle.getTable(sqlQuery, &row) != MSG_SUCCESS) { dbHandle.freeTable(); - dbHandle.endTrans(false); return MSG_ERR_DB_PREPARE; } @@ -155,20 +147,16 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) { MSG_DEBUG("MsgStoUpdateConversation() Error"); dbHandle.freeTable(); - dbHandle.endTrans(false); - return MSG_ERR_STORAGE_ERROR; } } else { MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery); dbHandle.freeTable(); - dbHandle.endTrans(false); return MSG_ERR_DB_STEP; } dbHandle.freeTable(); - dbHandle.endTrans(true); MSG_END(); diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp index 9a58a10..0959cc3 100755 --- a/utils/MsgSqliteWrapper.cpp +++ b/utils/MsgSqliteWrapper.cpp @@ -42,22 +42,12 @@ __thread sqlite3_stmt *stmt = NULL; ==================================================================================================*/ MsgDbHandler::MsgDbHandler() { - handle = NULL; - stmt = NULL; result = NULL; } MsgDbHandler::~MsgDbHandler() { - if(handle != NULL) { - if (disconnect() != MSG_SUCCESS) - MSG_DEBUG("disconnect is failed!!"); - } - - if(stmt != NULL) - finalizeQuery(); - if(result != NULL) freeTable(); } -- 2.7.4