From 398fc088a6819f5cb914c10a4d202312231448b9 Mon Sep 17 00:00:00 2001 From: Sangkoo Kim Date: Thu, 11 Oct 2012 14:53:44 +0900 Subject: [PATCH] Apply new contacts-service db. Change-Id: Ib735f9f3ab666b75a678c23cf4027cebd29efd7b --- include/common/MsgStorageTypes.h | 7 ------- utils/MsgContact.cpp | 12 ++---------- utils/MsgUtilStorage.cpp | 17 +++++++---------- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/include/common/MsgStorageTypes.h b/include/common/MsgStorageTypes.h index 5d3c88f..cd28fa0 100755 --- a/include/common/MsgStorageTypes.h +++ b/include/common/MsgStorageTypes.h @@ -98,7 +98,6 @@ typedef struct typedef struct { msg_contact_id_t contactId; /**< Indicates the unique contact ID. */ - char displayName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the display name of contact. */ char firstName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the first name of contact. */ char lastName[MAX_DISPLAY_NAME_LEN+1]; /**< Indicates the last name of contact. */ char imagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of contact. */ @@ -150,11 +149,5 @@ typedef struct } MSG_SEARCH_CONDITION_S; -typedef struct -{ - int appcode; - char appid[MAX_WAPPUSH_ID_LEN]; -} PUSH_APPLICATION_INFO_S; - #endif // MSG_STORAGE_TYPES_H diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp index 6aecb5e..8be3436 100755 --- a/utils/MsgContact.cpp +++ b/utils/MsgContact.cpp @@ -153,14 +153,10 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I return MSG_SUCCESS; } - const char* strDisplayName = contacts_svc_value_get_str(name, CTS_NAME_VAL_DISPLAY_STR); const char* strFirstName = contacts_svc_value_get_str(name, CTS_NAME_VAL_FIRST_STR); const char* strLastName = contacts_svc_value_get_str(name, CTS_NAME_VAL_LAST_STR); - MSG_DEBUG("Display Name : [%s], First Name : [%s], Last Name : [%s]", strDisplayName, strFirstName, strLastName); - - if (strDisplayName != NULL) - strncpy(pContactInfo->displayName, strDisplayName, MAX_DISPLAY_NAME_LEN); + MSG_DEBUG("First Name : [%s], Last Name : [%s]", strFirstName, strLastName); if (strFirstName != NULL) strncpy(pContactInfo->firstName, strFirstName, MAX_DISPLAY_NAME_LEN); @@ -320,14 +316,10 @@ bool MsgUpdateContact(int index, int type) return MSG_SUCCESS; } - const char* strDisplayName = contacts_svc_value_get_str(name, CTS_NAME_VAL_DISPLAY_STR); const char* strFirstName = contacts_svc_value_get_str(name, CTS_NAME_VAL_FIRST_STR); const char* strLastName = contacts_svc_value_get_str(name, CTS_NAME_VAL_LAST_STR); - MSG_DEBUG("Display Name : [%s], First Name : [%s], Last Name : [%s]", strDisplayName, strFirstName, strLastName); - - if (strDisplayName != NULL) - strncpy(contactInfo.displayName, strDisplayName, MAX_DISPLAY_NAME_LEN); + MSG_DEBUG("First Name : [%s], Last Name : [%s]", strFirstName, strLastName); if (strFirstName != NULL) strncpy(contactInfo.firstName, strFirstName, MAX_DISPLAY_NAME_LEN); diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index 525e41b..a5aaccc 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -375,7 +375,7 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * // Add Address memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, '%s', %d, ?, ?, ?, '%s', 0);", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, '%s', %d, '', ?, ?, '%s', 0);", MSGFW_ADDRESS_TABLE_NAME, addrId, *pConvId, pMsg->addressList[i].addressType, pMsg->addressList[i].recipientType, pMsg->addressList[i].addressVal, contactInfo.contactId, contactInfo.imagePath); @@ -384,9 +384,8 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - pDbHandle->bindText(contactInfo.displayName, 1); - pDbHandle->bindText(contactInfo.firstName, 2); - pDbHandle->bindText(contactInfo.lastName, 3); + pDbHandle->bindText(contactInfo.firstName, 1); + pDbHandle->bindText(contactInfo.lastName, 2); if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) { pDbHandle->finalizeQuery(); @@ -1032,13 +1031,13 @@ msg_error_t MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pC memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET \ - CONTACT_ID = %d, DISPLAY_NAME = ?, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ + CONTACT_ID = %d, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ WHERE ADDRESS_VAL LIKE '%%%%%s';", MSGFW_ADDRESS_TABLE_NAME, pContactInfo->contactId, pContactInfo->imagePath, newPhoneNum); } else { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET \ - CONTACT_ID = %d, DISPLAY_NAME = ?, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ + CONTACT_ID = %d, FIRST_NAME = ?, LAST_NAME = ?, IMAGE_PATH = '%s' \ WHERE ADDRESS_VAL = '%s';", MSGFW_ADDRESS_TABLE_NAME, pContactInfo->contactId, pContactInfo->imagePath, pNumber); } @@ -1046,11 +1045,9 @@ msg_error_t MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pC if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_PREPARE; - pDbHandle->bindText(pContactInfo->displayName, 1); + pDbHandle->bindText(pContactInfo->firstName, 1); - pDbHandle->bindText(pContactInfo->firstName, 2); - - pDbHandle->bindText(pContactInfo->lastName, 3); + pDbHandle->bindText(pContactInfo->lastName, 2); if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) { pDbHandle->finalizeQuery(); -- 2.7.4