From 1e579a3281bef13e87aa53a69ba8cd6fb398573b Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Tue, 6 Dec 2016 11:09:13 +0900 Subject: [PATCH] internal modified string comes out when keyword is not matched Change-Id: I9558829b9dd258321b496355af4b4790cd64860b --- server/ctsvc_utils_string.c | 9 +++++---- server/db/ctsvc_db_query.c | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/server/ctsvc_utils_string.c b/server/ctsvc_utils_string.c index 7a69bd3..275c606 100644 --- a/server/ctsvc_utils_string.c +++ b/server/ctsvc_utils_string.c @@ -474,7 +474,8 @@ static bool _get_modified_number(char *temp, char *keyword, int *out_len_keyword cursor_number++; cursor_keyword++; } - if (false == is_start) { /* false to search */ + if (false == is_start) { + DBG("false to search"); return false; } *out_len_keyword = len_keyword; @@ -542,7 +543,7 @@ char *ctsvc_utils_get_modified_str(char *temp, bool is_snippet, const char *keyw if (NULL == pos_at) { /* LCOV_EXCL_START */ ERR("Invalid value[%s]", temp); - return NULL; + return strdup(temp); /* LCOV_EXCL_STOP */ } DBG("[%s]", temp); @@ -578,7 +579,7 @@ char *ctsvc_utils_get_modified_str(char *temp, bool is_snippet, const char *keyw } if (false == is_modified) - return NULL; + return strdup(temp); len_full = strlen(temp) + strlen(start_match) + strlen(end_match) + 1; @@ -586,7 +587,7 @@ char *ctsvc_utils_get_modified_str(char *temp, bool is_snippet, const char *keyw if (NULL == mod_temp) { /* LCOV_EXCL_START */ ERR("calloc() Fail"); - return NULL; + return strdup(temp); /* LCOV_EXCL_STOP */ } diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index 2c7081b..40e84ce 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -524,7 +524,6 @@ static char *_get_search_query_for_name(const char *keyword) if (use_replaced_keyword) free(half_keyword); - DBG("[%s]", query); return strdup(query); } @@ -646,7 +645,6 @@ static char *_get_search_query_for_number(const char *keyword) if (use_replaced_keyword) free(half_keyword); - DBG("[%s]", query); return strdup(query); } @@ -728,7 +726,6 @@ static char *_get_search_query_for_data(const char *keyword) if (use_replaced_keyword) free(half_keyword); - DBG("[%s]", query); return strdup(query); } @@ -1486,7 +1483,6 @@ static int __db_create_projection(const char *view_uri, field_name); } } - DBG("[%s]", out_projection); *projection = strdup(out_projection); return CONTACTS_ERROR_NONE; @@ -2760,7 +2756,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, free(query_name); /* datatype=1 NAME */ - temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") AND datatype=1 "); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") AND datatype=1 AND is_my_profile=0 "); if (0 <= temp_len) len += temp_len; @@ -2785,7 +2781,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, free(query_number); /* datatype=8 NUMBER */ - temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") AND datatype=8 "); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") AND datatype=8 AND is_my_profile=0 "); if (0 <= temp_len) len += temp_len; @@ -2821,7 +2817,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, "WHEN datatype=%d THEN data3 " /* EMAIL */ "WHEN datatype=%d THEN data3 " /* RELATIONSHIP */ "WHEN datatype=%d THEN data3 " /* NOTE */ - "END) as _data FROM "CTS_TABLE_DATA" WHERE contact_id IN (", + "END) as _data FROM "CTS_TABLE_DATA" WHERE is_my_profile=0 AND contact_id IN (", CONTACTS_DATA_TYPE_POSTAL, CONTACTS_DATA_TYPE_MESSENGER, CONTACTS_DATA_TYPE_COMPANY, CONTACTS_DATA_TYPE_NICKNAME, CONTACTS_DATA_TYPE_EMAIL, CONTACTS_DATA_TYPE_RELATIONSHIP, CONTACTS_DATA_TYPE_NOTE, CONTACTS_DATA_TYPE_POSTAL, CONTACTS_DATA_TYPE_MESSENGER, -- 2.7.4