From: Donghee Ye Date: Fri, 22 Mar 2013 11:44:21 +0000 (+0900) Subject: Update 0.9.56.1 X-Git-Tag: accepted/tizen_2.1/20130425.033130~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e213aa4f68178d0e5da4528f55abe21b6b377e0;p=platform%2Fcore%2Fpim%2Fcontacts-service.git Update 0.9.56.1 - Change group name - Fix : can not update group name if the group is_read_only property is set - Fix favorite person unlink - Fix contact_id, my_profile_id check logic when updating - Fix comment - Fix memory leak - Fix BS when searching with keyword Change-Id: Ief33e73a356e44e2a9783b91784e45edd3145559 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e11bef7..dd38811 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}") SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.9.55") +SET(VERSION "${VERSION_MAJOR}.9.56.1") EXECUTE_PROCESS(COMMAND build-util/generator.sh) diff --git a/common/ctsvc_internal.h b/common/ctsvc_internal.h index 4deffb7..2180941 100644 --- a/common/ctsvc_internal.h +++ b/common/ctsvc_internal.h @@ -76,7 +76,7 @@ #define CTS_DBG(fmt, arg...) #define CTS_WARN(fmt, arg...) - #define CTS_ERR(fmt, arg...) ERR(IPC_ROLE" "fmt, ##arg) + #define CTS_ERR(fmt, arg...) ERR(fmt, ##arg) #define CTS_INFO(fmt, arg...) #define CTS_VERBOSE(fmt, arg...) diff --git a/common/ctsvc_normalize.c b/common/ctsvc_normalize.c index b56d2b8..1bb5df6 100644 --- a/common/ctsvc_normalize.c +++ b/common/ctsvc_normalize.c @@ -318,6 +318,9 @@ int ctsvc_normalize_number(const char *src, char *dest, int dest_size, int min_m { int ret; + RETV_IF(NULL == src, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == dest, CONTACTS_ERROR_INVALID_PARAMETER); + ret = __ctsvc_normalize_number(src, dest, dest_size, min_match); if (ret != CONTACTS_ERROR_NONE) { CTS_ERR("__ctsvc_normalize_number(src) failed(%d)", src, ret); diff --git a/common/ctsvc_record_group.c b/common/ctsvc_record_group.c index 4a323b9..f797a09 100644 --- a/common/ctsvc_record_group.c +++ b/common/ctsvc_record_group.c @@ -231,7 +231,7 @@ static int __ctsvc_group_get_bool(contacts_record_h record, unsigned int propert *value = group->is_read_only; break; default: - ASSERT_NOT_REACHED("Invalid parameter : property_id(%d) is not supported in value(company)", property_id); + ASSERT_NOT_REACHED("Invalid parameter : property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; } return CONTACTS_ERROR_NONE; diff --git a/common/ctsvc_record_phonelog.c b/common/ctsvc_record_phonelog.c index 6ee4f0e..d2214aa 100644 --- a/common/ctsvc_record_phonelog.c +++ b/common/ctsvc_record_phonelog.c @@ -97,7 +97,7 @@ static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *o RETVM_IF(NULL == out_data, CONTACTS_ERROR_OUT_OF_MEMORY, "Out of memeory : calloc(ctsvc_phonelog_s) Failed(%d)", CONTACTS_ERROR_OUT_OF_MEMORY); - out_data->id = src_data->id; + out_data->id = src_data->id; out_data->address = SAFE_STRDUP(src_data->address); out_data->person_id = src_data->person_id; out_data->log_time = src_data->log_time; diff --git a/common/ctsvc_setting.c b/common/ctsvc_setting.c index 298d638..da39065 100644 --- a/common/ctsvc_setting.c +++ b/common/ctsvc_setting.c @@ -32,10 +32,12 @@ #include "ctsvc_localize.h" static int name_display_order = -1; +static int name_sorting_order = -1; static int primary_sort = -1; static int secondary_sort = -1; static const char *CTSVC_VCONF_DISPLAY_ORDER = VCONFKEY_CONTACTS_SVC_NAME_DISPLAY_ORDER; +static const char *CTSVC_VCONF_SORTING_ORDER = VCONFKEY_CONTACTS_SVC_NAME_SORTING_ORDER; const char* ctsvc_get_default_language_vconfkey(void) { @@ -47,7 +49,7 @@ API int contacts_setting_get_name_display_order(contacts_name_display_order_e *o int ret; if (name_display_order < 0) { - ret = vconf_get_int(VCONFKEY_CONTACTS_SVC_NAME_DISPLAY_ORDER, &name_display_order); + ret = vconf_get_int(CTSVC_VCONF_DISPLAY_ORDER, &name_display_order); RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int() Failed(%d)", ret); } @@ -62,21 +64,55 @@ API int contacts_setting_set_name_display_order(contacts_name_display_order_e or RETVM_IF(CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST != order && CONTACTS_NAME_DISPLAY_ORDER_LASTFIRST != order, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The parameter(order:%d) is Invalid", name_display_order); - ret = vconf_set_int(VCONFKEY_CONTACTS_SVC_NAME_DISPLAY_ORDER, order); - RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(%s) Failed(%d)", VCONFKEY_CONTACTS_SVC_NAME_DISPLAY_ORDER, ret); + ret = vconf_set_int(CTSVC_VCONF_DISPLAY_ORDER, order); + RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(%s) Failed(%d)", CTSVC_VCONF_DISPLAY_ORDER, ret); name_display_order = order; return CONTACTS_ERROR_NONE; } -static void ctsvc_vconf_diplay_order_cb(keynode_t *key, void *data) +API int contacts_setting_get_name_sorting_order(contacts_name_sorting_order_e *order) +{ + int ret; + if (name_sorting_order < 0) + { + ret = vconf_get_int(CTSVC_VCONF_SORTING_ORDER, &name_sorting_order); + RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_get_int() Failed(%d)", ret); + } + + *order = name_sorting_order; + + return CONTACTS_ERROR_NONE; +} + +API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e order) +{ + int ret; + RETVM_IF(CONTACTS_NAME_SORTING_ORDER_FIRSTLAST != order && CONTACTS_NAME_SORTING_ORDER_LASTFIRST != order, + CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The parameter(order:%d) is Invalid", name_sorting_order); + + ret = vconf_set_int(CTSVC_VCONF_SORTING_ORDER, order); + RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "System : vconf_set_int(%s) Failed(%d)", CTSVC_VCONF_SORTING_ORDER, ret); + + name_sorting_order = order; + + return CONTACTS_ERROR_NONE; +} + +static void ctsvc_vconf_display_order_cb(keynode_t *key, void *data) { name_display_order = vconf_keynode_get_int(key); } +static void ctsvc_vconf_sorting_order_cb(keynode_t *key, void *data) +{ + name_sorting_order = vconf_keynode_get_int(key); +} + static void ctsvc_vconf_language_cb(keynode_t *key, void *data) { + primary_sort = vconf_keynode_get_int(key); { if (primary_sort==CTSVC_SORT_KOREAN) @@ -98,6 +134,12 @@ int ctsvc_register_vconf(void) name_display_order = CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST; } + ret = vconf_get_int(CTSVC_VCONF_SORTING_ORDER, &name_sorting_order); + if (ret < 0) { + CTS_ERR("vconf_get_int() Failed(%d)", ret); + name_sorting_order = CONTACTS_NAME_SORTING_ORDER_FIRSTLAST; + } + ret = vconf_get_int(ctsvc_get_default_language_vconfkey(), &primary_sort); WARN_IF(ret < 0, "vconf_get_int() Failed(%d)", ret); @@ -111,9 +153,13 @@ int ctsvc_register_vconf(void) } ret = vconf_notify_key_changed(CTSVC_VCONF_DISPLAY_ORDER, - ctsvc_vconf_diplay_order_cb, NULL); + ctsvc_vconf_display_order_cb, NULL); RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(%s) Failed(%d)", CTSVC_VCONF_DISPLAY_ORDER, ret); + ret = vconf_notify_key_changed(CTSVC_VCONF_SORTING_ORDER, + ctsvc_vconf_sorting_order_cb, NULL); + RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(%s) Failed(%d)", + CTSVC_VCONF_SORTING_ORDER, ret); ret = vconf_notify_key_changed(ctsvc_get_default_language_vconfkey(), ctsvc_vconf_language_cb, NULL); RETVM_IF(ret<0, CONTACTS_ERROR_SYSTEM, "vconf_notify_key_changed(%s) Failed(%d)", @@ -126,8 +172,11 @@ void ctsvc_deregister_vconf(void) { int ret; - ret = vconf_ignore_key_changed(CTSVC_VCONF_DISPLAY_ORDER, ctsvc_vconf_diplay_order_cb); + ret = vconf_ignore_key_changed(CTSVC_VCONF_DISPLAY_ORDER, ctsvc_vconf_display_order_cb); RETM_IF(ret<0,"vconf_ignore_key_changed(%s) Failed(%d)",CTSVC_VCONF_DISPLAY_ORDER,ret); + ret = vconf_ignore_key_changed(CTSVC_VCONF_SORTING_ORDER, ctsvc_vconf_sorting_order_cb); + RETM_IF(ret<0,"vconf_ignore_key_changed(%s) Failed(%d)",CTSVC_VCONF_SORTING_ORDER,ret); + ret = vconf_ignore_key_changed(ctsvc_get_default_language_vconfkey(), ctsvc_vconf_language_cb); RETM_IF(ret<0,"vconf_ignore_key_changed(%s) Failed(%d)", ctsvc_get_default_language_vconfkey(),ret); } diff --git a/contacts-service2.manifest b/contacts-service2.manifest index 952b4f0..3072d89 100644 --- a/contacts-service2.manifest +++ b/contacts-service2.manifest @@ -10,9 +10,9 @@ - + - + diff --git a/include/contacts_setting.h b/include/contacts_setting.h index 410eebb..896741e 100755 --- a/include/contacts_setting.h +++ b/include/contacts_setting.h @@ -74,6 +74,49 @@ API int contacts_setting_get_name_display_order(contacts_name_display_order_e *n */ API int contacts_setting_set_name_display_order(contacts_name_display_order_e name_display_order); + +/** + * @brief Enumerations of name display order + */ +typedef enum +{ + CONTACTS_NAME_SORTING_ORDER_FIRSTLAST, /**< Contacts are first sorted based on the first name */ + CONTACTS_NAME_SORTING_ORDER_LASTFIRST /**< Contacts are first sorted based on the last name */ +} contacts_name_sorting_order_e; + + +/** + * @brief Gets the contacts name sorting order in which contacts are returned. + * + * @param[out] name_sorting_order The name sorting order + * + * @return 0 on success, otherwise a negative error value. + * @retval #CONTACTS_ERROR_NONE Successful + * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONTACTS_ERROR_DB Database operation failure + * + * @pre This function requires an open connection to the contacts service by contacts_connect2(). + * + * @see contacts_connect2() + */ +API int contacts_setting_get_name_sorting_order(contacts_name_sorting_order_e *name_sort_order); + +/** + * @brief Sets the contacts name sorting order in which contacts are returned. + * + * @param[in] name_sorting_order The name sorting order + * + * @return 0 on success, otherwise a negative error value. + * @retval #CONTACTS_ERROR_NONE Successful + * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONTACTS_ERROR_DB Database operation failure + * + * @pre This function requires an open connection to the contacts service by contacts_connect2(). + * + * @see contacts_connect2() + */ +API int contacts_setting_set_name_sorting_order(contacts_name_sorting_order_e name_sorting_order); + /** * @} */ diff --git a/include/contacts_views.h b/include/contacts_views.h index 4e21722..feb21ef 100755 --- a/include/contacts_views.h +++ b/include/contacts_views.h @@ -127,7 +127,7 @@ _CONTACTS_BEGIN_VIEW() _CONTACTS_PROPERTY_INT( id ) // read only _CONTACTS_PROPERTY_STR( display_name ) // read only _CONTACTS_PROPERTY_INT( address_book_id ) // read, write once - _CONTACTS_PROPERTY_STR( image_thumbnail_path ) // read, write + _CONTACTS_PROPERTY_STR( image_thumbnail_path ) // read only _CONTACTS_PROPERTY_STR( uid ) // read, write _CONTACTS_PROPERTY_INT( changed_time ) // read only _CONTACTS_PROPERTY_CHILD_SINGLE( name ) // read, write diff --git a/native/ctsvc_db_plugin_address_helper.c b/native/ctsvc_db_plugin_address_helper.c index 1bb6fba..04aae50 100644 --- a/native/ctsvc_db_plugin_address_helper.c +++ b/native/ctsvc_db_plugin_address_helper.c @@ -133,7 +133,7 @@ int ctsvc_db_address_update(contacts_record_h record, bool is_my_profile) char* set = NULL; GSList *bind_text = NULL; GSList *cursor = NULL; - ctsvc_address_s *address = (ctsvc_address_s*)record; + ctsvc_address_s *address = (ctsvc_address_s*)record; char query[CTS_SQL_MAX_LEN] = {0}; RETVM_IF(address->id <= 0, CONTACTS_ERROR_INVALID_PARAMETER, diff --git a/native/ctsvc_db_plugin_addressbook.c b/native/ctsvc_db_plugin_addressbook.c index 8b27e5c..0a0b73d 100644 --- a/native/ctsvc_db_plugin_addressbook.c +++ b/native/ctsvc_db_plugin_addressbook.c @@ -135,7 +135,7 @@ static int __ctsvc_db_addressbook_insert_record( contacts_record_h record, int * // Can not insert addressbook which has same account_id int addresbook_id; - account_h account; + account_h account = NULL; snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTS_TABLE_ADDRESSBOOKS" WHERE account_id = %d", addressbook->account_id); diff --git a/native/ctsvc_db_plugin_contact.c b/native/ctsvc_db_plugin_contact.c index 1b064f5..59bec7d 100644 --- a/native/ctsvc_db_plugin_contact.c +++ b/native/ctsvc_db_plugin_contact.c @@ -1071,7 +1071,7 @@ static int __ctsvc_db_contact_update_record( contacts_record_h record ) { int ret, len = 0; int rel_changed = 0; - int count; + int id; int version; char *set = NULL; char query[CTS_SQL_MAX_LEN] = {0}; @@ -1083,9 +1083,9 @@ static int __ctsvc_db_contact_update_record( contacts_record_h record ) RETVM_IF(ret, ret, "ctsvc_begin_trans() Failed(%d)", ret); snprintf(query, sizeof(query), - "SELECT count(contact_id) FROM "CTS_TABLE_CONTACTS" " + "SELECT contact_id FROM "CTS_TABLE_CONTACTS" " "WHERE contact_id = %d AND deleted = 0", contact->id); - ret = ctsvc_query_get_first_int_result(query, &count); + ret = ctsvc_query_get_first_int_result(query, &id); if (CONTACTS_ERROR_NONE != ret) { CTS_ERR("The index(%d) is Invalid. %d Record(s) is(are) found", contact->id, ret); ctsvc_end_trans(false); diff --git a/native/ctsvc_db_plugin_group.c b/native/ctsvc_db_plugin_group.c index 211aca6..3a25934 100644 --- a/native/ctsvc_db_plugin_group.c +++ b/native/ctsvc_db_plugin_group.c @@ -36,7 +36,6 @@ static int __ctsvc_db_group_update_record( contacts_record_h record ); static int __ctsvc_db_group_delete_record( int id ); static int __ctsvc_db_group_get_all_records( int offset, int limit, contacts_list_h* out_list ); static int __ctsvc_db_group_get_records_with_query( contacts_query_h query, int offset, int limit, contacts_list_h* out_list ); -static double __ctsvc_db_group_get_next_group_prio(void); //static int __ctsvc_db_group_insert_records(const contacts_list_h in_list, int **ids); //static int __ctsvc_db_group_update_records(const contacts_list_h in_list); //static int __ctsvc_db_group_delete_records( int ids[], int count); @@ -58,6 +57,26 @@ ctsvc_db_plugin_info_s ctsvc_db_plugin_group = { .replace_records = NULL, }; +static double __ctsvc_db_group_get_next_group_prio(void) +{ + int ret; + double prio = 0.0; + cts_stmt stmt; + char query[CTS_SQL_MAX_LEN] = {0}; + + snprintf(query, sizeof(query), "SELECT MAX(group_prio) FROM "CTS_TABLE_GROUPS" "); + + stmt = cts_query_prepare(query); + RETVM_IF(NULL == stmt, CONTACTS_ERROR_DB, "cts_query_prepare() Failed"); + + ret = cts_stmt_step(stmt); + if (1 /*CTS_TRUE*/ == ret) + prio = ctsvc_stmt_get_dbl(stmt, 0); + cts_stmt_finalize(stmt); + + return prio + 1.0; +} + static int __ctsvc_db_group_insert_record( contacts_record_h record, int *id ) { int ret; @@ -77,7 +96,6 @@ static int __ctsvc_db_group_insert_record( contacts_record_h record, int *id ) ret = ctsvc_begin_trans(); if( ret < CONTACTS_ERROR_NONE ) { CTS_ERR("DB error : ctsvc_begin_trans() Failed(%d)", ret); - ctsvc_end_trans(false); return ret; } @@ -156,8 +174,10 @@ static int __ctsvc_db_group_update_record( contacts_record_h record ) char* set = NULL; GSList *bind_text = NULL; GSList *cursor = NULL; - ctsvc_group_s *group = (ctsvc_group_s*)record; + ctsvc_group_s *group = (ctsvc_group_s*)record; char query[CTS_SQL_MAX_LEN] = {0}; + cts_stmt stmt = NULL; + bool is_read_only = false; RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); RETVM_IF(CTSVC_RECORD_GROUP != group->base.r_type, CONTACTS_ERROR_INVALID_PARAMETER, @@ -166,13 +186,41 @@ static int __ctsvc_db_group_update_record( contacts_record_h record ) RETVM_IF(NULL == group->name, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : The name of group is empty."); + ret = ctsvc_begin_trans(); + RETVM_IF(ret, ret, "ctsvc_begin_trans() Failed(%d)", ret); + snprintf(query, sizeof(query), - "SELECT addressbook_id FROM %s WHERE group_id = %d", + "SELECT addressbook_id, is_read_only FROM %s WHERE group_id = %d", CTS_TABLE_GROUPS, group->id); - ret = ctsvc_query_get_first_int_result(query, &addressbook_id); - if ( ret < CONTACTS_ERROR_NONE) { - CTS_ERR("DB error : The group record(%d) is Invalid(%d)", group->id, ret); - return ret; + stmt = cts_query_prepare(query); + if (NULL == stmt) { + CTS_ERR("DB error : cts_query_prepare() Failed"); + ctsvc_end_trans(false); + return CONTACTS_ERROR_DB; + } + + ret = cts_stmt_step(stmt); + if (1 != ret) { + CTS_ERR("DB error : cts_stmt_step() Failed(%d)", ret); + cts_stmt_finalize(stmt); + ctsvc_end_trans(false); + if (CONTACTS_ERROR_NONE == ret) { + CTS_ERR("DB error : The group record(%d) is Invalid(%d)", group->id, ret); + return CONTACTS_ERROR_NO_DATA; + } + else + return ret; + } + + addressbook_id = ctsvc_stmt_get_int(stmt, 0); + is_read_only = ctsvc_stmt_get_int(stmt, 1); + CTS_DBG("addressbook_id : %d, person_id : %d", addressbook_id, person_id); + cts_stmt_finalize(stmt); + + if (is_read_only && ctsvc_record_check_property_flag((ctsvc_record_s *)record, _contacts_group.name, CTSVC_PROPERTY_FLAG_DIRTY)) { + CTS_ERR("Can not change the group name. It is a read-only group (group_id : %d)", group->id); + ctsvc_end_trans(false); + return CONTACTS_ERROR_INVALID_PARAMETER; } if (group->image_thumbnail_changed) { @@ -185,9 +233,6 @@ static int __ctsvc_db_group_update_record( contacts_record_h record ) group->image_thumbnail_changed = false; } - ret = ctsvc_begin_trans(); - RETVM_IF(ret, ret, "ctsvc_begin_trans() Failed(%d)", ret); - do { char query[CTS_SQL_MAX_LEN] = {0}; char query_set[CTS_SQL_MAX_LEN] = {0}; @@ -510,25 +555,6 @@ static int __ctsvc_db_group_get_records_with_query( contacts_query_h query, return CONTACTS_ERROR_NONE; } -double __ctsvc_db_group_get_next_group_prio(void) -{ - int ret; - double prio = 0.0; - cts_stmt stmt; - char query[CTS_SQL_MAX_LEN] = {0}; - - snprintf(query, sizeof(query), "SELECT MAX(group_prio) FROM "CTS_TABLE_GROUPS" "); - - stmt = cts_query_prepare(query); - RETVM_IF(NULL == stmt, CONTACTS_ERROR_DB, "cts_query_prepare() Failed"); - - ret = cts_stmt_step(stmt); - if (1 /*CTS_TRUE*/ == ret) - prio = ctsvc_stmt_get_dbl(stmt, 0); - cts_stmt_finalize(stmt); - - return prio + 1.0; -} //static int __ctsvc_db_group_insert_records(const contacts_list_h in_list, int **ids) { return CONTACTS_ERROR_NONE; } //static int __ctsvc_db_group_update_records(const contacts_list_h in_list) { return CONTACTS_ERROR_NONE; } //static int __ctsvc_db_group_delete_records( int ids[], int count) { return CONTACTS_ERROR_NONE; } diff --git a/native/ctsvc_db_plugin_my_profile.c b/native/ctsvc_db_plugin_my_profile.c index 2bb4a02..2fadd0f 100644 --- a/native/ctsvc_db_plugin_my_profile.c +++ b/native/ctsvc_db_plugin_my_profile.c @@ -543,7 +543,7 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile) static int __ctsvc_db_my_profile_update_record( contacts_record_h record ) { int ret, len; - int count; + int id; char query[CTS_SQL_MAX_LEN] = {0}; ctsvc_my_profile_s *my_profile = (ctsvc_my_profile_s*)record; cts_stmt stmt; @@ -552,8 +552,8 @@ static int __ctsvc_db_my_profile_update_record( contacts_record_h record ) RETVM_IF(ret, ret, "ctsvc_begin_trans() Failed(%d)", ret); snprintf(query, sizeof(query), - "SELECT count(my_profile_id) FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", my_profile->id); - ret = ctsvc_query_get_first_int_result(query, &count); + "SELECT my_profile_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", my_profile->id); + ret = ctsvc_query_get_first_int_result(query, &id); if (CONTACTS_ERROR_NONE != ret) { CTS_ERR("The index(%d) is Invalid. %d Record(s) is(are) found", my_profile->id, ret); ctsvc_end_trans(false); diff --git a/native/ctsvc_db_plugin_url.c b/native/ctsvc_db_plugin_url.c index baa93cc..f2e6633 100644 --- a/native/ctsvc_db_plugin_url.c +++ b/native/ctsvc_db_plugin_url.c @@ -88,15 +88,6 @@ static int __ctsvc_db_url_insert_record( contacts_record_h record, int *id ) return ret; } - snprintf(query, sizeof(query), - "SELECT contact_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", url->contact_id); - ret = ctsvc_query_get_first_int_result(query, &contact_id); - if (CONTACTS_ERROR_NONE != ret) { - CTS_ERR("No data : contact_id (%d) is not exist", contact_id); - ctsvc_end_trans(false); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - ret = ctsvc_db_contact_update_changed_time(url->contact_id); if (CONTACTS_ERROR_NONE != ret) { CTS_ERR("DB error : ctsvc_db_contact_update_changed_time() Failed(%d)", ret); diff --git a/native/ctsvc_db_query.c b/native/ctsvc_db_query.c index a58ef4a..d610296 100755 --- a/native/ctsvc_db_query.c +++ b/native/ctsvc_db_query.c @@ -925,7 +925,7 @@ static int __ctsvc_db_append_search_query(const char *keyword, char *query, int static int __ctsvc_db_search_records_exec(const char *view_uri, const property_info_s* properties, int ids_count, const char *projection, const char *keyword, int offset, int limit, contacts_list_h* out_list ) { - char query[CTS_SQL_MAX_LEN] = {0}; + char query[CTS_SQL_MAX_LEN*8] = {0}; // temporarily extend const char *table; int len; int ret; @@ -1089,7 +1089,7 @@ static int __ctsvc_db_search_records(const char* view_uri, const char *keyword, static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_query, const char *projection, const char *condition, GSList *bind, const char *keyword, int offset, int limit, contacts_list_h * out_list ) { - char query[CTS_SQL_MAX_LEN] = {0}; + char query[CTS_SQL_MAX_LEN*8] = {0}; // temporarily extend int len; int ret; int i; diff --git a/native/ctsvc_person.c b/native/ctsvc_person.c index 07c4c30..e01515c 100644 --- a/native/ctsvc_person.c +++ b/native/ctsvc_person.c @@ -1060,7 +1060,7 @@ API int contacts_person_unlink_contact(int person_id, int contact_id, int* out_p if (is_favorite && ((ctsvc_contact_s*)record)->is_favorite) { snprintf(query, sizeof(query), - "INSERT INTO "CTS_TABLE_FAVORITES" values(%d, %f)", id, priority); + "INSERT OR REPLACE INTO "CTS_TABLE_FAVORITES" values(%d, %f)", id, priority); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { CTS_ERR("ctsvc_query_exec() Failed(%d)", ret); diff --git a/packaging/contacts-service.spec b/packaging/contacts-service.spec index 0240570..d447edd 100644 --- a/packaging/contacts-service.spec +++ b/packaging/contacts-service.spec @@ -1,6 +1,6 @@ Name: contacts-service Summary: Contacts Service -Version: 0.9.55 +Version: 0.9.56.1 Release: 1 Group: TO_BE/FILLED_IN License: Apache-2.0 diff --git a/schema.sql b/schema.sql index 0d8a0d4..4e22529 100755 --- a/schema.sql +++ b/schema.sql @@ -239,11 +239,11 @@ CREATE TABLE groups ); INSERT INTO groups(addressbook_id, group_name, extra_data, is_read_only, created_ver, changed_ver, group_prio) - VALUES(0, 'coworkers', 'coworkers', 0, 0, 0, 1); + VALUES(0, 'Co-workers', 'coworkers', 0, 0, 0, 1); INSERT INTO groups(addressbook_id, group_name, extra_data, is_read_only, created_ver, changed_ver, group_prio) - VALUES(0, 'family', 'family', 0, 0, 0, 2); + VALUES(0, 'Family', 'family', 0, 0, 0, 2); INSERT INTO groups(addressbook_id, group_name, extra_data, is_read_only, created_ver, changed_ver, group_prio) - VALUES(0, 'friends', 'friends',0, 0, 0, 3); + VALUES(0, 'Friends', 'friends',0, 0, 0, 3); CREATE TRIGGER trg_groups_del AFTER DELETE ON groups BEGIN