summaryrefslogtreecommitdiff
path: root/utils/MsgUtilStorage.cpp
diff options
context:
space:
mode:
authorSangkoo Kim <sangkoo.kim@samsung.com>2012-10-25 15:06:27 +0900
committerSangkoo Kim <sangkoo.kim@samsung.com>2012-10-26 02:10:43 +0900
commit2a2590470a124d7b951b930ec13300758dad1da1 (patch)
treed1423de2caaab45be335a7c590e4098cbd37d343 /utils/MsgUtilStorage.cpp
parent169f6bb958dd91c7f7eaabdc193ca7269fc49d8c (diff)
downloadmsg-service-2a2590470a124d7b951b930ec13300758dad1da1.tar.gz
msg-service-2a2590470a124d7b951b930ec13300758dad1da1.tar.bz2
msg-service-2a2590470a124d7b951b930ec13300758dad1da1.zip
Merge from private.
Change-Id: I430d3546541d8bd946aea5e15223ef52e82edf16
Diffstat (limited to 'utils/MsgUtilStorage.cpp')
-rwxr-xr-xutils/MsgUtilStorage.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp
index a5aaccc..8f59666 100755
--- a/utils/MsgUtilStorage.cpp
+++ b/utils/MsgUtilStorage.cpp
@@ -63,10 +63,10 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0, 0, 0);",
MSGFW_MESSAGE_TABLE_NAME, msgId, pMsgInfo->threadId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType,
pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected,
- pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+ pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup);
MSG_DEBUG("QUERY : %s", sqlQuery);
@@ -477,7 +477,7 @@ msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t ms
char lastName[MAX_DISPLAY_NAME_LEN+1];
pAddress->nCount = 0;
- pAddress->nCount = NULL;
+ pAddress->msg_struct_info = NULL;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_TYPE, A.RECIPIENT_TYPE, \
@@ -659,11 +659,13 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
char msgText[MAX_THREAD_DATA_LEN+1];
char sqlQuery[MAX_QUERY_LEN+1];
+ memset(msgText, 0x00, sizeof(msgText));
+
// Get Unread Count
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND READ_STATUS = 0;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND STORAGE_ID = %d AND READ_STATUS = 0;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
@@ -682,8 +684,8 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
// Get SMS Count
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_SPAMBOX_ID);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
@@ -704,8 +706,9 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \
- WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, MSG_SPAMBOX_ID);
+ WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS,
+ MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
@@ -730,8 +733,8 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, SUBJECT, MSG_TEXT FROM %s \
- WHERE CONV_ID = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d ORDER BY DISPLAY_TIME DESC;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SPAMBOX_ID);
+ WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME DESC;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
@@ -1395,6 +1398,22 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread
return err;
}
+msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE MSG_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, status, pMsgInfo->msgId);
+
+ if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ err = MSG_ERR_DB_EXEC;
+
+ return err;
+}
char *MsgStoReplaceString(const char *origStr, const char *oldStr, const char *newStr)
{