Move set_folder_item_validity 23/198723/1 submit/tizen/20190129.064431
authorMinje Ahn <minje.ahn@samsung.com>
Tue, 29 Jan 2019 05:27:55 +0000 (14:27 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Tue, 29 Jan 2019 05:27:55 +0000 (14:27 +0900)
Move plugin to media-common

Change-Id: I17e60de39312f20282be171b08c21ba92babb1f0
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media-svc.h
plugin/media-content-plugin.c
src/common/media-svc-media.c
src/common/media-svc.c
src/include/common/media-svc-media.h

index 25b0656..ad8f460 100755 (executable)
@@ -48,7 +48,6 @@ int media_svc_set_item_validity_begin(int data_cnt);
 int media_svc_set_item_validity_end(uid_t uid);
 int media_svc_set_item_validity(const char *storage_id, const char *path, int validity, uid_t uid);
 int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int media_svc_set_folder_items_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid);
 int media_svc_refresh_item(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
 int media_svc_send_dir_update_noti(sqlite3 *handle, const char *storage_id, const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
 int media_svc_check_db_upgrade(sqlite3 *handle, int user_version, uid_t uid);
index 5c8a242..aa5a420 100755 (executable)
@@ -46,11 +46,6 @@ int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path,
        return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
 }
 
-int set_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid)
-{
-       return media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid);
-}
-
 int set_item_validity_begin(int item_cnt)
 {
        return media_svc_set_item_validity_begin(item_cnt);
index 6517727..29918ed 100755 (executable)
@@ -455,57 +455,6 @@ int _media_svc_update_thumbnail_path(const char *storage_id, const char *path, c
        return ret;
 }
 
-int _media_svc_update_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, uid_t uid)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-       char *sql = NULL;
-       char folder_uuid[MEDIA_SVC_UUID_SIZE + 1] = {0, };
-       sqlite3_stmt *sql_stmt = NULL;
-
-       media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
-       media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "folder_path is NULL");
-
-       /*Get folder ID*/
-       sql = sqlite3_mprintf("SELECT folder_uuid FROM '%q' WHERE path='%q' AND storage_uuid='%q'", MEDIA_SVC_DB_TABLE_FOLDER, folder_path, storage_id);
-
-       ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-       if (ret != MS_MEDIA_ERR_NONE) {
-               if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
-                       media_svc_debug("folder not exist");
-               else
-                       media_svc_error("error when get folder_id. err = [%d]", ret);
-
-               return ret;
-       }
-
-       SAFE_STRLCPY(folder_uuid, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE + 1);
-       SQLITE3_FINALIZE(sql_stmt);
-
-       /*Update folder item validity*/
-       sql = sqlite3_mprintf("UPDATE '%q' SET validity=%d WHERE folder_uuid='%q';", storage_id, validity, folder_uuid);
-
-       ret = _media_svc_sql_query(sql, uid);
-       SQLITE3_SAFE_FREE(sql);
-
-       return ret;
-}
-
-int _media_svc_update_recursive_folder_item_validity(const char *storage_id, const char *folder_path, int validity, uid_t uid)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-
-       media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
-       media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "folder_path is NULL");
-
-       /*Update folder item validity*/
-       char *sql = sqlite3_mprintf("UPDATE '%q' SET validity=%d WHERE (storage_type = 0 OR storage_type = 1) AND path LIKE '%q/%%';", storage_id, validity, folder_path);
-
-       ret = _media_svc_sql_query(sql, uid);
-       SQLITE3_SAFE_FREE(sql);
-
-       return ret;
-}
-
 int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, uid_t uid)
 {
        /* update path, filename, modified_time, folder_uuid, thumbnail_path, */
index 49974ae..bc0fd96 100755 (executable)
@@ -582,14 +582,6 @@ int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const
        return MS_MEDIA_ERR_NONE;
 }
 
-int media_svc_set_folder_items_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid)
-{
-       if (recursive)
-               return _media_svc_update_recursive_folder_item_validity(storage_id, folder_path, validity, uid);
-       else
-               return _media_svc_update_folder_item_validity(handle, storage_id, folder_path, validity, uid);
-}
-
 int media_svc_refresh_item(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
index fd0d007..091b496 100755 (executable)
@@ -34,8 +34,6 @@ int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_i
 int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path);
 int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, const char *path, int *media_type);
 int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid);
-int _media_svc_update_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, uid_t uid);
-int _media_svc_update_recursive_folder_item_validity(const char *storage_id, const char *folder_path, int validity, uid_t uid);
 int _media_svc_update_item_validity(const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid);
 int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, uid_t uid);
 int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid);