diff options
author | Minje Ahn <minje.ahn@samsung.com> | 2019-05-21 15:24:07 +0900 |
---|---|---|
committer | Minje Ahn <minje.ahn@samsung.com> | 2019-05-21 15:24:07 +0900 |
commit | bec5a260db6a66987d1ec4ac444b4a01b422ccf0 (patch) | |
tree | fb04a9e37379346c5f21e784d37e20bc55ee0d93 /src | |
parent | 90626b8365312836b9875522580f9ce01ae27634 (diff) | |
download | libmedia-service-bec5a260db6a66987d1ec4ac444b4a01b422ccf0.tar.gz libmedia-service-bec5a260db6a66987d1ec4ac444b4a01b422ccf0.tar.bz2 libmedia-service-bec5a260db6a66987d1ec4ac444b4a01b422ccf0.zip |
Remove the queue for the folder insertion
No longer needed due to scanner logic changes
Change-Id: I22eb66179d2983e821c25bdeb4aa76f91af8195e
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/common/media-svc-media-folder.c | 37 | ||||
-rwxr-xr-x | src/common/media-svc-media.c | 3 | ||||
-rwxr-xr-x | src/common/media-svc.c | 61 | ||||
-rwxr-xr-x | src/include/common/media-svc-env.h | 1 | ||||
-rwxr-xr-x | src/include/common/media-svc-media-folder.h | 3 |
5 files changed, 13 insertions, 92 deletions
diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c index 46f3a93..9427eb0 100755 --- a/src/common/media-svc-media-folder.c +++ b/src/common/media-svc-media-folder.c @@ -27,8 +27,6 @@ #include "media-svc-util.h" #include "media-svc-db-utils.h" -static __thread GList *g_media_svc_insert_folder_query_list; - int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_id, const char *folder_name, char *folder_id, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; @@ -80,8 +78,7 @@ int _media_svc_get_folder_id_by_foldername_with_validity(sqlite3 *handle, const return ret; } -static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, - const char *folder_id, const char *folder_path, bool stack_query, uid_t uid) +static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *folder_id, const char *folder_path, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; char *folder_name = NULL; @@ -98,16 +95,12 @@ static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_ char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_id, folder_path, folder_name, storage_uuid, folder_storage_type, folder_modified_time, folder_name_pinyin) values (%Q, %Q, %Q, %Q, '%d', '%d', %Q); ", MEDIA_SVC_DB_TABLE_FOLDER, folder_id, folder_path, folder_name, storage_id, storage_type, folder_modified_date, folder_name_pinyin); - if (!stack_query) { - if (is_direct) - ret = _media_svc_sql_query_direct(sql, uid); - else - ret = _media_svc_sql_query(sql, uid); + if (is_direct) + ret = _media_svc_sql_query_direct(sql, uid); + else + ret = _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - } else { - _media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql); - } + SQLITE3_SAFE_FREE(sql); SAFE_FREE(folder_name); SAFE_FREE(folder_name_pinyin); @@ -190,7 +183,7 @@ static int __media_svc_get_and_append_parent_folder(sqlite3 *handle, bool is_dir return MS_MEDIA_ERR_INTERNAL; } - ret = __media_svc_append_folder(is_direct, storage_id, storage_type, folder_uuid, dir_path, FALSE, uid); + ret = __media_svc_append_folder(is_direct, storage_id, storage_type, folder_uuid, dir_path, uid); if (ret != MS_MEDIA_ERR_NONE) media_svc_error("__media_svc_append_folder is failed"); @@ -295,11 +288,12 @@ int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, return ret; } -int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, char *folder_id, bool stack_query, uid_t uid) +int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid) { char *path_name = NULL; int ret = MS_MEDIA_ERR_NONE; char *sql = NULL; + char folder_id[MEDIA_SVC_UUID_SIZE + 1] = {0, }; path_name = strdup(path); if (path_name == NULL) { @@ -312,12 +306,8 @@ int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const ch ret = __media_svc_get_and_append_parent_folder(handle, true, storage_id, path_name, storage_type, folder_id, uid); } else { sql = sqlite3_mprintf("UPDATE %q SET validity=1 WHERE storage_uuid = '%q' AND folder_path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, path); - if (!stack_query) { - ret = _media_svc_sql_query_direct(sql, uid); - SQLITE3_SAFE_FREE(sql); - } else { - _media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql); - } + ret = _media_svc_sql_query_direct(sql, uid); + SQLITE3_SAFE_FREE(sql); } SAFE_FREE(path_name); @@ -348,11 +338,6 @@ int _media_svc_set_folder_validity(sqlite3 *handle, bool is_direct, const char * return ret; } -GList **_media_svc_get_folder_list_ptr(void) -{ - return &g_media_svc_insert_folder_query_list; -} - int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count) { int ret = MS_MEDIA_ERR_NONE; diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 365c885..8c462e1 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -544,9 +544,6 @@ int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid) case MEDIA_SVC_QUERY_UPDATE_ITEM: ret = _media_svc_sql_query_list_direct(&g_media_svc_update_item_query_list, uid); break; - case MEDIA_SVC_QUERY_INSERT_FOLDER: - ret = _media_svc_sql_query_list_direct(_media_svc_get_folder_list_ptr(), uid); - break; default: media_svc_error("Wrong type[%d]", query_type); return MS_MEDIA_ERR_INVALID_PARAMETER; diff --git a/src/common/media-svc.c b/src/common/media-svc.c index b3f508d..4a5078c 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -41,9 +41,6 @@ static __thread int g_media_svc_insert_item_cur_data_cnt = 0; static __thread int g_media_svc_update_item_data_cnt = 1; static __thread int g_media_svc_update_item_cur_data_cnt = 0; -static __thread int g_media_svc_insert_folder_data_cnt = 1; -static __thread int g_media_svc_insert_folder_cur_data_cnt = 0; - /* Flag for items to be published by notification */ static __thread int g_insert_with_noti = FALSE; @@ -832,70 +829,14 @@ int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char return ret; } -int media_svc_insert_folder_begin(int data_cnt) -{ - media_svc_debug("Transaction data count : [%d]", data_cnt); - - media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1"); - - g_media_svc_insert_folder_data_cnt = data_cnt; - g_media_svc_insert_folder_cur_data_cnt = 0; - - return MS_MEDIA_ERR_NONE; -} - -int media_svc_insert_folder_end(uid_t uid) -{ - int ret = MS_MEDIA_ERR_NONE; - - media_svc_debug_fenter(); - - if (g_media_svc_insert_folder_cur_data_cnt > 0) - ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_FOLDER, uid); - - g_media_svc_insert_folder_data_cnt = 1; - g_media_svc_insert_folder_cur_data_cnt = 0; - - return ret; -} - int media_svc_insert_folder(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; - char folder_uuid[MEDIA_SVC_UUID_SIZE+1] = {0,}; - media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL"); media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL"); media_svc_retvm_if(_media_svc_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type"); - if (g_media_svc_insert_folder_data_cnt == 1) { - - ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, FALSE, uid); - - } else if (g_media_svc_insert_folder_cur_data_cnt < (g_media_svc_insert_folder_data_cnt - 1)) { - - ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, TRUE, uid); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - g_media_svc_insert_folder_cur_data_cnt++; - - } else if (g_media_svc_insert_folder_cur_data_cnt == (g_media_svc_insert_folder_data_cnt - 1)) { - - ret = _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, folder_uuid, TRUE, uid); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_FOLDER, uid); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - g_media_svc_insert_folder_cur_data_cnt = 0; - - } else { - media_svc_error("Error in media_svc_set_insert_folder"); - return MS_MEDIA_ERR_INTERNAL; - } - - return ret; + return _media_svc_get_and_append_folder_id_by_folder_path(handle, storage_id, path, storage_type, uid); } int media_svc_set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid) diff --git a/src/include/common/media-svc-env.h b/src/include/common/media-svc-env.h index 42e327a..3dfd52c 100755 --- a/src/include/common/media-svc-env.h +++ b/src/include/common/media-svc-env.h @@ -157,7 +157,6 @@ typedef enum { MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, MEDIA_SVC_QUERY_MOVE_ITEM, MEDIA_SVC_QUERY_UPDATE_ITEM, - MEDIA_SVC_QUERY_INSERT_FOLDER, MEDIA_SVC_QUERY_UPDATE_COMMON, } media_svc_query_type_e; diff --git a/src/include/common/media-svc-media-folder.h b/src/include/common/media-svc-media-folder.h index 284c4fb..412d6de 100755 --- a/src/include/common/media-svc-media-folder.h +++ b/src/include/common/media-svc-media-folder.h @@ -31,9 +31,8 @@ int _media_svc_get_folder_id_by_foldername_with_validity(sqlite3 *handle, const int _media_svc_update_folder_modified_time_by_folder_uuid(const char *folder_uuid, const char *folder_path, uid_t uid); int _media_svc_get_and_append_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, char *folder_id, uid_t uid); int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, char *folder_id, uid_t uid); -int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, char *folder_id, bool stack_query, uid_t uid); +int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid); int _media_svc_set_folder_validity(sqlite3 *handle, bool is_direct, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid); -GList ** _media_svc_get_folder_list_ptr(void); int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count); |