*/
#include <stdlib.h>
+#include <unique_ptr.h>
#include <FBaseDateTime.h>
#include <FBaseColArrayList.h>
#include <FBaseColArrayListT.h>
#include "FScl_AddressbookImpl.h"
#include "FScl_UserProfileImpl.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
std::unique_ptr<Category> pCategory(new (std::nothrow) Category());
SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- int ret = contacts_db_get_record(_contacts_group._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ unique_ptr<ContactRecord, ContactRecordDeleter> pCategoryRecord(_AddressbookUtil::GetContactRecordN(_contacts_group._uri, intValue));
+ SysTryReturn(NID_SCL, pCategoryRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(newRecord);
+ _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(pCategoryRecord.release());
_RecordImpl::GetInstance(*pCategory)->SetRecordId(intValue);
__Filter<__ContactsGroupRelation> filter;
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
std::unique_ptr<Category> pCategory(new (std::nothrow) Category());
SysTryReturn(NID_SCL, pCategory != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int ret = contacts_db_get_record(_contacts_group._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ unique_ptr<ContactRecord, ContactRecordDeleter> pCategoryRecord(_AddressbookUtil::GetContactRecordN(_contacts_group._uri, intValue));
+ SysTryReturn(NID_SCL, pCategoryRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(newRecord);
+ _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(pCategoryRecord.release());
_RecordImpl::GetInstance(*pCategory)->SetRecordId(intValue);
__Filter<__ContactsGroupRelation> filter;
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
std::unique_ptr<Contact> pContact(new (std::nothrow) Contact());
SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int ret = contacts_db_get_record(_contacts_contact._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ unique_ptr<ContactRecord, ContactRecordDeleter> pContactRecord(_AddressbookUtil::GetContactRecordN(_contacts_contact._uri, intValue));
+ SysTryReturn(NID_SCL, pContactRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(newRecord);
+ _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(pContactRecord.release());
_RecordImpl::GetInstance(*pContact)->SetRecordId(intValue);
return pContact.release();
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
std::unique_ptr<Contact> pContact(new (std::nothrow) Contact());
SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int ret = contacts_db_get_record(_contacts_contact._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ unique_ptr<ContactRecord, ContactRecordDeleter> pContactRecord(_AddressbookUtil::GetContactRecordN(_contacts_contact._uri, intValue));
+ SysTryReturn(NID_SCL, pContactRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(newRecord);
+ _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(pContactRecord.release());
_RecordImpl::GetInstance(*pContact)->SetRecordId(intValue);
return pContact.release();
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
std::unique_ptr<Contact> pContact(new (std::nothrow) Contact());
SysTryReturn(NID_SCL, pContact != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- int ret = contacts_db_get_record(_contacts_contact._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The contact is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
+ unique_ptr<ContactRecord, ContactRecordDeleter> pContactRecord(_AddressbookUtil::GetContactRecordN(_contacts_contact._uri, intValue));
+ SysTryReturn(NID_SCL, pContactRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(newRecord);
+ _ContactImpl::GetInstance(*pContact)->SetContactRecordHandle(pContactRecord.release());
_RecordImpl::GetInstance(*pContact)->SetRecordId(intValue);
return pContact.release();
contacts_record_get_str_p(currentRecord, _contacts_person.display_name, &pCharValue);
_PersonImpl::GetInstance(*pPerson)->SetDisplayName(pCharValue);
-
+
return pPerson.release();
}
_AddressbookUtil::CreatePersonN(void)
{
Person* pPerson = new (std::nothrow) Person();
- return pPerson;
+ return pPerson;
}
template<>
contacts_record_get_str_p(currentRecord, _contacts_person_grouprel.display_name, &pCharValue);
_PersonImpl::GetInstance(*pPerson)->SetDisplayName(pCharValue);
-
+
return pPerson.release();
}
SysTryReturn(NID_SCL, _ContactDbConnector::EnsureDbConnection() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int intValue = 0;
- contacts_record_h newRecord = null;
contacts_record_h currentRecord = searchResult.GetCurrentRecord();
SysTryReturn(NID_SCL, currentRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
contacts_record_get_int(currentRecord, _contacts_person_grouprel.group_id, &intValue);
SysTryReturn(NID_SCL, intValue > 0, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- int ret = contacts_db_get_record(_contacts_group._uri, intValue, &newRecord);
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_NO_DATA, null, E_OBJ_NOT_FOUND, "[%s] The category is not found.", GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_OUT_OF_MEMORY, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, null, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
- _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(newRecord);
+ unique_ptr<ContactRecord, ContactRecordDeleter> pCategoryRecord(_AddressbookUtil::GetContactRecordN(_contacts_group._uri, intValue));
+ SysTryReturn(NID_SCL, pCategoryRecord != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ _CategoryImpl::GetInstance(*pCategory)->SetRecordHandle(pCategoryRecord.release());
_RecordImpl::GetInstance(*pCategory)->SetRecordId(intValue);
__Filter<__ContactsGroupRelation> filter;
contacts_record_get_str_p(recordHandle, _contacts_person.display_name, &pCharValue);
_PersonImpl::GetInstance(*pPerson)->SetDisplayName(pCharValue);
-
+
return pPerson.release();
}
contacts_record_get_str_p(recordHandle, _contacts_person_grouprel.display_name, &pCharValue);
_PersonImpl::GetInstance(*pPerson)->SetDisplayName(pCharValue);
-
+
return pPerson.release();
}