fixed prevent 10/46810/1
authorGukhwan Cho <gh78.cho@samsung.com>
Wed, 26 Aug 2015 06:21:56 +0000 (15:21 +0900)
committerGukhwan Cho <gh78.cho@samsung.com>
Wed, 26 Aug 2015 09:17:48 +0000 (18:17 +0900)
Change-Id: If3ba01ea59369c19cb25a66e9370dcbe3660c053
Signed-off-by: Gukhwan Cho <gh78.cho@samsung.com>
server/db/ctsvc_db_query.c

index 026d571..2ef9cae 100644 (file)
@@ -1411,7 +1411,6 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
        else {
                char *normalized_name = NULL;
                int lang = CTSVC_LANG_OTHERS;
-               bool add_brace = false;
                char *hiragana = NULL;
                char *search_hiragana = NULL;
                bool need_union = false;
@@ -1454,7 +1453,6 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                        if (need_union) {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM (");
                                if (0 <= temp_len) len += temp_len;
-                               add_brace = true;
                        }
                        temp_len = SAFE_SNPRINTF(query, query_size, len, " SELECT contact_id FROM ");
                        if (0 <= temp_len) len += temp_len;
@@ -1488,10 +1486,9 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                                                                        CONTACTS_SEARCH_RANGE_DATA, NULL, NULL, temp_str);
                                if (0 <= temp_len) len = temp_len;
                        }
-                       if (add_brace) {
+                       if (need_union) {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, ") ");
                                if (0 <= temp_len) len += temp_len;
-                               add_brace = false;
                        }
                        need_union = true;
                }
@@ -1500,7 +1497,6 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                        if (need_union) {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, " UNION SELECT contact_id FROM (");
                                if (0 <= temp_len) len += temp_len;
-                               add_brace = true;
                        }
 
                        if (CTSVC_LANG_KOREAN == lang) {   /* chosung search */
@@ -1627,10 +1623,9 @@ static int __ctsvc_db_append_search_query(const char *src, char **query, int *qu
                        temp_len = SAFE_SNPRINTF(query, query_size, len, "%%' ESCAPE '\\' ");   /* CTSVC_DB_ESCAPE_CHAR */
                        if (0 <= temp_len) len += temp_len;
 
-                       if (add_brace) {
+                       if (need_union) {
                                temp_len = SAFE_SNPRINTF(query, query_size, len, ") ");
                                if (0 <= temp_len) len += temp_len;
-                               add_brace = false;
                        }
                }