From: Minje Ahn Date: Tue, 26 Mar 2019 01:10:01 +0000 (+0900) Subject: Remove alias keyword from bookmark query X-Git-Tag: accepted/tizen/unified/20190328.234707~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7af11cbe60aa14acd5d8e67de0992b90b876deb;p=platform%2Fcore%2Fapi%2Fmedia-content.git Remove alias keyword from bookmark query Change-Id: Idc17b73f869e0c33de788ccd6db38243eda3599c Signed-off-by: Minje Ahn --- diff --git a/include/media_info_private.h b/include/media_info_private.h index 06c07f4..1bbc300 100755 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -379,7 +379,6 @@ typedef struct _media_content_cb_data { #define DB_TABLE_ALIAS_PLAYLIST "p" #define DB_TABLE_ALIAS_PLAYLIST_MAP "pm" #define DB_TABLE_ALIAS_TAG "t" -#define DB_TABLE_ALIAS_BOOKMARK "b" /* DB field for media */ #define DB_FIELD_MEDIA_ID "media_uuid" @@ -475,7 +474,7 @@ typedef struct _media_content_cb_data { /* DB TABLE JOIN */ #define FOLDER_MEDIA_JOIN "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.validity=1 " -#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1" +#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE validity=1" #define ALBUM_MEDIA_JOIN "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m ON (a.album_id = m.album_id)) WHERE m.validity=1" #define FACE_MEDIA_JOIN "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m ON (fa.media_uuid = m.media_uuid)) WHERE validity=1" @@ -494,7 +493,7 @@ typedef struct _media_content_cb_data { #define SELECT_FOLDER_COUNT_BY_STORAGE_ID SELECT_FOLDER_COUNT"AND f.storage_uuid='%s' " #define SELECT_TAG_COUNT "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 " #define SELECT_PLAYLIST_COUNT "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 " -#define SELECT_BOOKMARK_COUNT "SELECT COUNT(DISTINCT b.bookmark_id) FROM "BOOKMARK_MEDIA_JOIN +#define SELECT_BOOKMARK_COUNT "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN #define SELECT_MEDIA_GROUP_COUNT "SELECT COUNT(*) FROM ("SELECT_MEDIA_GROUP_LIST /*count(distinct x) count only non-null values, but select distinct X returns include null. so sync the result of count and list, don't use count(distinct x)*/ @@ -544,8 +543,8 @@ typedef struct _media_content_cb_data { /* Bookmark */ #define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path, name) VALUES ('%q', '%d', %Q, %Q)" #define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" -#define SELECT_BOOKMARK_LIST "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN -#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" +#define SELECT_BOOKMARK_LIST "SELECT bookmark_id, b.media_uuid, marked_time, b.thumbnail_path, name FROM "BOOKMARK_MEDIA_JOIN +#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT bookmark_id, b.media_uuid, marked_time, b.thumbnail_path, name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" #define SELECT_BOOKMARK_ID_FROM_BOOKMARK "SELECT bookmark_id FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%s' AND marked_time=%d" #define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;" diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index 808d1f1..ac73582 100755 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -481,7 +481,6 @@ typedef struct _media_content_scan_cb_data_v2 { #define DB_TABLE_ALIAS_PLAYLIST "p" #define DB_TABLE_ALIAS_PLAYLIST_MAP "pm" #define DB_TABLE_ALIAS_TAG "t" -#define DB_TABLE_ALIAS_BOOKMARK "b" /* DB field for media */ #define DB_FIELD_MEDIA_ID "media_uuid" @@ -640,7 +639,7 @@ typedef struct _media_content_scan_cb_data_v2 { /* DB TABLE JOIN */ #define FOLDER_MEDIA_JOIN "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.validity=1 " -#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1" +#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE validity=1" #define ALBUM_MEDIA_JOIN "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m ON (a.album_id = m.album_id)) WHERE m.validity=1" #define FACE_MEDIA_JOIN "("DB_TABLE_FACE" AS fa INNER JOIN '%s' AS m ON (fa.media_uuid = m.media_uuid)) WHERE validity=1" @@ -662,7 +661,7 @@ typedef struct _media_content_scan_cb_data_v2 { #define SELECT_FOLDER_COUNT_BY_STORAGE_ID SELECT_FOLDER_COUNT"AND f.storage_uuid='%s' " #define SELECT_TAG_COUNT "SELECT COUNT(DISTINCT tag_id) FROM "DB_VIEW_TAG" WHERE 1 " #define SELECT_PLAYLIST_COUNT "SELECT COUNT(DISTINCT playlist_id) FROM "DB_VIEW_PLAYLIST" WHERE 1 " -#define SELECT_BOOKMARK_COUNT "SELECT COUNT(DISTINCT b.bookmark_id) FROM "BOOKMARK_MEDIA_JOIN +#define SELECT_BOOKMARK_COUNT "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN #define SELECT_MEDIA_GROUP_COUNT "SELECT COUNT(*) FROM ("SELECT_MEDIA_GROUP_LIST /*count(distinct x) count only non-null values, but select distinct X returns include null. so sync the result of count and list, don't use count(distinct x)*/ @@ -721,8 +720,8 @@ typedef struct _media_content_scan_cb_data_v2 { /* Bookmark */ #define INSERT_BOOKMARK_TO_BOOKMARK "INSERT INTO "DB_TABLE_BOOKMARK" (media_uuid, marked_time, thumbnail_path, name) VALUES ('%q', '%d', %Q, %Q)" #define SELECT_BOOKMARK_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" -#define SELECT_BOOKMARK_LIST "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN -#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT b.bookmark_id, b.media_uuid, b.marked_time, b.thumbnail_path, b.name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" +#define SELECT_BOOKMARK_LIST "SELECT bookmark_id, b.media_uuid, marked_time, b.thumbnail_path, name FROM "BOOKMARK_MEDIA_JOIN +#define SELECT_BOOKMARK_LIST_BY_MEDIA_ID "SELECT bookmark_id, b.media_uuid, marked_time, b.thumbnail_path, name FROM "BOOKMARK_MEDIA_JOIN" AND b.media_uuid='%s'" #define SELECT_BOOKMARK_ID_FROM_BOOKMARK "SELECT bookmark_id FROM "DB_TABLE_BOOKMARK" WHERE media_uuid='%s' AND marked_time=%d" #define UPDATE_BOOKMARK_FROM_BOOKMARK "UPDATE "DB_TABLE_BOOKMARK" SET name=%Q WHERE bookmark_id=%d;" diff --git a/src/media_content.c b/src/media_content.c index 0b8adcc..23523e8 100755 --- a/src/media_content.c +++ b/src/media_content.c @@ -110,9 +110,9 @@ static media_content_attribute_info_s g_content_attrs_info[] = { {TAG_MEDIA_COUNT, DB_FIELD_TAG_MEDIA_COUNT, NULL}, /* Bookmark */ - {MEDIA_BOOKMARK_ID, DB_FIELD_BOOKMARK_ID, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_ID}, - {BOOKMARK_MARKED_TIME, DB_FIELD_BOOKMARK_MARKED_TIME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_MARKED_TIME}, - {BOOKMARK_NAME, DB_FIELD_BOOKMARK_NAME, DB_TABLE_ALIAS_BOOKMARK"."DB_FIELD_BOOKMARK_NAME}, + {MEDIA_BOOKMARK_ID, DB_FIELD_BOOKMARK_ID, NULL}, + {BOOKMARK_MARKED_TIME, DB_FIELD_BOOKMARK_MARKED_TIME, NULL}, + {BOOKMARK_NAME, DB_FIELD_BOOKMARK_NAME, NULL}, /* Storage */ {MEDIA_STORAGE_ID, DB_FIELD_STORAGE_ID, NULL}, diff --git a/src/media_db.c b/src/media_db.c index 28ada2a..6da5108 100755 --- a/src/media_db.c +++ b/src/media_db.c @@ -274,8 +274,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro } break; case MEDIA_GROUP_BOOKMARK: - attr = _content_get_alias_attirbute_handle(); - if ((_filter != NULL) && STRING_VALID(_filter->storage_id)) snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT, _filter->storage_id); else @@ -784,7 +782,7 @@ int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark attribute_h attr = NULL; filter_s *_filter = (filter_s*)filter; - attr = _content_get_alias_attirbute_handle(); + attr = _content_get_attirbute_handle(); memset(select_query, 0x00, sizeof(select_query)); @@ -984,8 +982,6 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou } else if (group_type == MEDIA_GROUP_TAG_BY_MEDIA_ID) { snprintf(select_query, sizeof(select_query), SELECT_TAG_COUNT_BY_MEDIA_ID, group_name); } else if (group_type == MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID) { - attr = _content_get_alias_attirbute_handle(); - if ((_filter != NULL) && STRING_VALID(_filter->storage_id)) tmp_query = sqlite3_mprintf(SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, _filter->storage_id, group_name); else