diff options
author | Minje Ahn <minje.ahn@samsung.com> | 2019-09-04 15:38:05 +0900 |
---|---|---|
committer | Minje Ahn <minje.ahn@samsung.com> | 2019-09-04 15:40:27 +0900 |
commit | 9014bddf2b1f7a563d35975b570aa11bfebc9c07 (patch) | |
tree | ad18555d51918fd6306619b6f1d189e6fc31dece | |
parent | 3947ffdb96b338e9a2b5584c506dcf4fc3cc21a1 (diff) | |
download | libmedia-service-9014bddf2b1f7a563d35975b570aa11bfebc9c07.tar.gz libmedia-service-9014bddf2b1f7a563d35975b570aa11bfebc9c07.tar.bz2 libmedia-service-9014bddf2b1f7a563d35975b570aa11bfebc9c07.zip |
Remove batch db threadsubmit/tizen/20190905.232826accepted/tizen/unified/20190909.010905
Use db update thread instead
Change-Id: Ibe93aca44d2f3954c838221c6a52df1778f0ab38
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-x | src/common/media-svc-db-utils.c | 30 | ||||
-rwxr-xr-x | src/common/media-svc-media.c | 18 | ||||
-rwxr-xr-x | src/include/common/media-svc-db-utils.h | 2 |
3 files changed, 4 insertions, 46 deletions
diff --git a/src/common/media-svc-db-utils.c b/src/common/media-svc-db-utils.c index 57a9c19..9cf30bc 100755 --- a/src/common/media-svc-db-utils.c +++ b/src/common/media-svc-db-utils.c @@ -1658,28 +1658,6 @@ int _media_svc_sql_prepare_to_step_simple(sqlite3 *handle, const char *sql_str, return MS_MEDIA_ERR_NONE; } -int _media_svc_sql_begin_trans(uid_t uid) -{ - int ret = MS_MEDIA_ERR_NONE; - - media_svc_debug("Batch start(Transaction block version)"); - - ret = media_db_request_update_db_batch_start("BEGIN IMMEDIATE;", uid); - - return ret; -} - -int _media_svc_sql_end_trans(uid_t uid) -{ - int ret = MS_MEDIA_ERR_NONE; - - media_svc_debug("Batch end(Transaction block version)"); - - ret = media_db_request_update_db_batch_end("COMMIT;", uid); - - return ret; -} - int _media_svc_sql_query_list(GList **query_list, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; @@ -1706,9 +1684,9 @@ int _media_svc_sql_query_list(GList **query_list, uid_t uid) } if ((total_len + query_len) >= (sizeof(query_bundle) - 1)) { - ret = media_db_request_update_db_batch(query_bundle, uid); + ret = media_db_request_update_db(query_bundle, uid); if (ret != MS_MEDIA_ERR_NONE) - media_svc_error("media_db_request_update_db_batch failed : %d", ret); + media_svc_error("media_db_request_update_db failed : %d", ret); memset(query_bundle, 0, sizeof(query_bundle)); total_len = 0; @@ -1728,9 +1706,9 @@ int _media_svc_sql_query_list(GList **query_list, uid_t uid) } if (total_len > 0) { - ret = media_db_request_update_db_batch(query_bundle, uid); + ret = media_db_request_update_db(query_bundle, uid); if (ret != MS_MEDIA_ERR_NONE) - media_svc_error("media_db_request_update_db_batch failed : %d", ret); + media_svc_error("media_db_request_update_db failed : %d", ret); memset(query_bundle, 0, sizeof(query_bundle)); total_len = 0; diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 0fe9de4..8222de7 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -475,7 +475,6 @@ int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_p int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; - char *sql = NULL; /* For multiples of 200, empty requests are possible */ switch (query_type) { @@ -483,24 +482,7 @@ int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid) if (g_media_svc_update_list == NULL || g_list_length(g_media_svc_update_list) == 0) return MS_MEDIA_ERR_NONE; - if (g_list_length(g_media_svc_update_list) == 1) { - sql = (char *)g_list_nth_data(g_media_svc_update_list, 0); - if (STRING_VALID(sql)) { - ret = _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - } - _media_svc_sql_query_release(&g_media_svc_update_list); - - return ret; - } - - ret = _media_svc_sql_begin_trans(uid); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - ret = _media_svc_sql_query_list(&g_media_svc_update_list, uid); - media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Failed to request queries"); - - ret = _media_svc_sql_end_trans(uid); break; case MEDIA_SVC_QUERY_SET_ITEM_VALIDITY: ret = _media_svc_sql_query_list_direct(&g_media_svc_item_validity_query_list, uid); diff --git a/src/include/common/media-svc-db-utils.h b/src/include/common/media-svc-db-utils.h index f108155..3462a8b 100755 --- a/src/include/common/media-svc-db-utils.h +++ b/src/include/common/media-svc-db-utils.h @@ -40,8 +40,6 @@ int _media_svc_sql_query_direct(const char *sql_str, uid_t uid); int _media_svc_get_user_version(sqlite3 *db_handle, int *user_version); int _media_svc_sql_prepare_to_step(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt); int _media_svc_sql_prepare_to_step_simple(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt); -int _media_svc_sql_begin_trans(uid_t uid); -int _media_svc_sql_end_trans(uid_t uid); int _media_svc_sql_query_list(GList **query_list, uid_t uid); int _media_svc_sql_query_list_direct(GList **query_list, uid_t uid); void _media_svc_sql_query_add(GList **query_list, char **query); |