summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude_product/media_info_private.h5
-rwxr-xr-xsrc/media_db.c17
2 files changed, 7 insertions, 15 deletions
diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h
index 978bb6e..7e728fe 100755
--- a/include_product/media_info_private.h
+++ b/include_product/media_info_private.h
@@ -547,11 +547,6 @@ typedef struct _media_content_scan_cb_data_v2 {
#define DB_FIELD_UHD_FILE_NAME "file_name"
#define DB_FIELD_UHD_PLAYED_COUNT "played_count"
-/* DB Query Keyword */
-#define QUERY_KEYWORD_AND "AND "
-#define QUERY_KEYWORD_SPACE " "
-#define QUERY_KEYWORD_BRACKET ")"
-
/* DB TABLE JOIN */
#define FOLDER_MEDIA_JOIN DB_TABLE_FOLDER" NATURAL LEFT OUTER JOIN '%s' WHERE validity=1 "
#define BOOKMARK_MEDIA_JOIN DB_TABLE_BOOKMARK" NATURAL JOIN '%s' WHERE validity=1 "
diff --git a/src/media_db.c b/src/media_db.c
index c39df01..4004c9c 100755
--- a/src/media_db.c
+++ b/src/media_db.c
@@ -284,6 +284,7 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
char select_query[MAX_QUERY_SIZE] = {0, };
char *condition_query = NULL;
char *option_query = NULL;
+ char *tmp_option = NULL;
filter_s *_filter = (filter_s *)filter;
memset(select_query, 0x00, sizeof(select_query));
@@ -306,17 +307,13 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
ret = __media_db_make_query(filter, &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- SAFE_STRLCAT(select_query, QUERY_KEYWORD_SPACE, sizeof(select_query));
- if (STRING_VALID(condition_query)) {
- SAFE_STRLCAT(select_query, QUERY_KEYWORD_AND, sizeof(select_query));
- SAFE_STRLCAT(select_query, condition_query, sizeof(select_query));
+ if (option_query) {
+ tmp_option = g_strconcat(option_query, ")", NULL);
+ g_free(option_query);
+ option_query = tmp_option;
+ } else {
+ SAFE_STRLCAT(select_query, ")", sizeof(select_query));
}
- if (STRING_VALID(option_query))
- SAFE_STRLCAT(select_query, option_query, sizeof(select_query));
- SAFE_STRLCAT(select_query, QUERY_KEYWORD_BRACKET, sizeof(select_query));
-
- SAFE_FREE(condition_query);
- SAFE_FREE(option_query);
ret = _content_query_prepare(select_query, condition_query, option_query, &stmt);
SAFE_FREE(condition_query);