From 1154d86e9a8a86ccff54adf7a5ab90f6b0dbdf1f Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Mon, 19 Apr 2021 15:21:46 +0900 Subject: [PATCH] Modify the query of getting playlist's item to order by ROWID [Problem] Playlist is sorted by item index. Playlist should not be sorted. [Cause] The database sort the data by item index. [Solution] Modify the query to order by ROWID. Change-Id: Ie9e21861bf425ee99aae6a16f6d383dce5ea4b79 --- src/media_controller_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/media_controller_db.c b/src/media_controller_db.c index e2d90c6..c77a5e2 100644 --- a/src/media_controller_db.c +++ b/src/media_controller_db.c @@ -629,7 +629,7 @@ int _mc_db_get_playlist_item(sqlite3 *handle, const char *server_name, char *pla mc_retvm_if(!playlist_name, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid playlist_name"); mc_retvm_if(!callback, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid callback"); - sql_str = sqlite3_mprintf("SELECT item_index, %s FROM %q WHERE server_name=%Q AND playlist_name=%Q AND item_index IS NOT NULL", META_LIST, MC_DB_TABLE_PLAYLIST, server_name, playlist_name); + sql_str = sqlite3_mprintf("SELECT item_index, %s FROM %q WHERE server_name=%Q AND playlist_name=%Q AND item_index IS NOT NULL ORDER BY ROWID", META_LIST, MC_DB_TABLE_PLAYLIST, server_name, playlist_name); mc_retvm_if(!MC_STRING_VALID(sql_str), MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "SQL string is null"); ret = sqlite3_prepare_v2(handle, sql_str, strlen(sql_str), &stmt, NULL); -- 2.7.4