Move logic for reset mediadb
[platform/core/multimedia/libmedia-service.git] / src / common / media-svc.c
index 4af9bde..52310ac 100755 (executable)
@@ -98,6 +98,17 @@ int media_svc_disconnect(MediaSvcHandle *handle)
        return ret;
 }
 
+int media_svc_cleanup_db(MediaSvcHandle *handle, uid_t uid)
+{
+       MediaDBHandle *db_handle = (MediaDBHandle *)handle;
+
+       media_svc_debug_fenter();
+
+       media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
+
+       return _media_svc_do_cleanup(db_handle, uid);
+}
+
 int media_svc_get_user_version(MediaSvcHandle *handle, int *user_version)
 {
        sqlite3 *db_handle = (sqlite3 *)handle;
@@ -1017,14 +1028,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
                if (no_thumb) {
                        update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_uuid);
                } else {
-#if 0
-                       if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)
-                               update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_new_thumb_path, media_uuid);
-                       else
-                               update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_thumb_path, media_uuid);
-#else
                        update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_new_thumb_path, media_uuid);
-#endif
                }
 
                ret = media_db_request_update_db_batch(update_item_sql, uid);
@@ -2053,4 +2057,3 @@ int media_svc_get_media_type(const char *path, int *mediatype)
        return _media_svc_get_media_type(path, mediatype);
 }
 
-