diff options
author | vivek <vivek.ellur@samsung.com> | 2013-06-21 17:16:38 +0530 |
---|---|---|
committer | vivek <vivek.ellur@samsung.com> | 2013-06-26 11:06:29 +0530 |
commit | 789125a94243118910e1339854f165aa9b678bae (patch) | |
tree | 0bd67e63ae944333ec5bb50febd7cd4522e7adde | |
parent | a9366f1c94c596f13ef27a5a20afd67c72e4dba8 (diff) | |
download | social-789125a94243118910e1339854f165aa9b678bae.tar.gz social-789125a94243118910e1339854f165aa9b678bae.tar.bz2 social-789125a94243118910e1339854f165aa9b678bae.zip |
Removed contacts_db_delete_record and added DeleteContactRecord in AddressbookUtil class
Change-Id: Ic54bff01a2b5aa23135d02661be036566401c12c
Signed-off-by: vivek <vivek.ellur@samsung.com>
-rw-r--r-- | src/FScl_AddressbookManagerImpl.cpp | 9 | ||||
-rw-r--r-- | src/FScl_AddressbookUtil.h | 15 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/FScl_AddressbookManagerImpl.cpp b/src/FScl_AddressbookManagerImpl.cpp index 9d61c18..3698b66 100644 --- a/src/FScl_AddressbookManagerImpl.cpp +++ b/src/FScl_AddressbookManagerImpl.cpp @@ -249,13 +249,10 @@ _AddressbookManagerImpl::CreateAddressbookN(AccountId accountId, const String& n result _AddressbookManagerImpl::DeleteAddressbook(AddressbookId addressbookId) { - SysTryReturn(NID_SCL, addressbookId > 0, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The addressbook ID is invalid or the default addressbook ID.", GetErrorMessage(E_INVALID_ARG)); + SysTryReturn(NID_SCL, addressbookId > 0, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument used.The addressbook ID is invalid or the default addressbook ID.", GetErrorMessage(E_INVALID_ARG)); SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - - int ret = contacts_db_delete_record(_contacts_address_book._uri, addressbookId); - SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The addressbook is not found.", GetErrorMessage(E_OBJ_NOT_FOUND)); -// SysTryReturnResult(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OPERATION_FAILED, "Failed to delete an addressbook.(%d)", ret); // temp + result r = _AddressbookUtil::DeleteContactRecord(_contacts_address_book._uri, addressbookId); + SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r)); return E_SUCCESS; } diff --git a/src/FScl_AddressbookUtil.h b/src/FScl_AddressbookUtil.h index a09076e..4a3d259 100644 --- a/src/FScl_AddressbookUtil.h +++ b/src/FScl_AddressbookUtil.h @@ -822,20 +822,29 @@ public: SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_FILE_NO_SPACE, E_STORAGE_FULL, E_STORAGE_FULL, "[%s] The storage is insufficient. (%d)", GetErrorMessage(E_STORAGE_FULL), ret); SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred. (%d)", GetErrorMessage(E_SYSTEM), ret); - return E_SUCCESS; } + static result DeleteContactRecord(const char* pUri, int recordId) + { + int ret = contacts_db_delete_record(pUri, recordId); + SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed. (%d)", GetErrorMessage(E_OUT_OF_MEMORY), ret); + SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The record is not found. (%d)", GetErrorMessage(E_OBJ_NOT_FOUND), ret); + SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred. (%d)", GetErrorMessage(E_SYSTEM), ret); + + return E_SUCCESS; + } static ContactRecord* GetContactRecordN(const char* pUri, RecordId recordId) { ClearLastResult(); contacts_record_h recordHandle = null; + int ret = contacts_db_get_record(pUri, recordId, &recordHandle); SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed. (%d)", GetErrorMessage(E_OUT_OF_MEMORY), ret); - SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The record %d is not found. (%d)", GetErrorMessage(E_OBJ_NOT_FOUND), recordId, ret); - SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. Record Id(%d). (%d)", GetErrorMessage(E_SYSTEM), recordId, ret); + SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The record is not found. (%d)", GetErrorMessage(E_OBJ_NOT_FOUND), ret); + SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred. (%d)", GetErrorMessage(E_SYSTEM), ret); return recordHandle; } |