internal modified string comes out when keyword is not matched 69/102469/1
authorJeesun Kim <iamjs.kim@samsung.com>
Tue, 6 Dec 2016 02:09:13 +0000 (11:09 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Tue, 6 Dec 2016 02:16:52 +0000 (11:16 +0900)
Change-Id: I9558829b9dd258321b496355af4b4790cd64860b

server/ctsvc_utils_string.c
server/db/ctsvc_db_query.c

index 7a69bd3..275c606 100644 (file)
@@ -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 */
        }
 
index 2c7081b..40e84ce 100644 (file)
@@ -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,