#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"
/* 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"
#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)*/
/* 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;"
#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"
/* 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"
#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)*/
/* 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;"
{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},
}
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
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));
} 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