From: jiyong.min Date: Mon, 19 Apr 2021 06:21:46 +0000 (+0900) Subject: Modify the query of getting playlist's item to order by ROWID X-Git-Tag: accepted/tizen/unified/20210430.052702~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1154d86e9a8a86ccff54adf7a5ab90f6b0dbdf1f;p=platform%2Fcore%2Fapi%2Fmedia-controller.git 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 --- 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);