From 50f4708675a5b38305e7a070501ee9afb15467de Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 26 Mar 2019 16:55:48 +0900 Subject: [PATCH] Remove alias keyword from album query Change-Id: I6384fa72b297229fa0fbfc563ed4d40ea2a0f315 Signed-off-by: Minje Ahn --- include/media_info_private.h | 6 +++--- include_product/media_info_private.h | 6 +++--- src/media_db.c | 4 +--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/media_info_private.h b/include/media_info_private.h index 1bbc300..54fa7e3 100755 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -475,11 +475,11 @@ 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 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 ALBUM_MEDIA_JOIN DB_TABLE_ALBUM" NATURAL JOIN '%s' WHERE 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" /* Get Group List */ -#define SELECT_ALBUM_LIST "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN +#define SELECT_ALBUM_LIST "SELECT DISTINCT album_id, name, artist, album_art FROM "ALBUM_MEDIA_JOIN #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 " #define SELECT_FOLDER_LIST "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.storage_uuid FROM "FOLDER_MEDIA_JOIN @@ -488,7 +488,7 @@ typedef struct _media_content_cb_data { #define SELECT_PLAYLIST_LIST "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 " /* Get Group Count */ -#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT a.album_id) FROM "ALBUM_MEDIA_JOIN +#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT album_id) FROM "ALBUM_MEDIA_JOIN #define SELECT_FOLDER_COUNT "SELECT COUNT(DISTINCT f.folder_uuid) FROM "FOLDER_MEDIA_JOIN #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 " diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index ac73582..9ae170c 100755 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -640,14 +640,14 @@ 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 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 ALBUM_MEDIA_JOIN DB_TABLE_ALBUM" NATURAL JOIN '%s' WHERE 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" /* Get Group info */ #define SELECT_MEDIA_GROUP_AND_COUNT "SELECT %s, COUNT(*) FROM '%s' WHERE validity=1 " /* Get Group List */ -#define SELECT_ALBUM_LIST "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN +#define SELECT_ALBUM_LIST "SELECT DISTINCT album_id, name, artist, album_art FROM "ALBUM_MEDIA_JOIN #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 " #define SELECT_FOLDER_LIST "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.storage_uuid FROM "FOLDER_MEDIA_JOIN @@ -656,7 +656,7 @@ typedef struct _media_content_scan_cb_data_v2 { #define SELECT_PLAYLIST_LIST "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 " /* Get Group Count */ -#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT a.album_id) FROM "ALBUM_MEDIA_JOIN +#define SELECT_ALBUM_COUNT "SELECT COUNT(DISTINCT album_id) FROM "ALBUM_MEDIA_JOIN #define SELECT_FOLDER_COUNT "SELECT COUNT(DISTINCT f.folder_uuid) FROM "FOLDER_MEDIA_JOIN #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 " diff --git a/src/media_db.c b/src/media_db.c index 6da5108..f63d1c0 100755 --- a/src/media_db.c +++ b/src/media_db.c @@ -244,8 +244,6 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro } break; case MEDIA_GROUP_ALBUM: - attr = _content_get_alias_attirbute_handle(); - if ((_filter != NULL) && STRING_VALID(_filter->storage_id)) snprintf(select_query, sizeof(select_query), SELECT_ALBUM_COUNT, _filter->storage_id); else @@ -520,7 +518,7 @@ int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_dat 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)); if ((_filter != NULL) && STRING_VALID(_filter->storage_id)) -- 2.7.4