diff options
-rwxr-xr-x | include/media-svc.h | 1 | ||||
-rwxr-xr-x | plugin/media-content-plugin.c | 3 | ||||
-rwxr-xr-x | src/common/media-svc-db-utils.c | 48 | ||||
-rwxr-xr-x | src/common/media-svc-media-folder.c | 2 | ||||
-rwxr-xr-x | src/common/media-svc.c | 7 | ||||
-rwxr-xr-x | src/include/common/media-svc-db-utils.h | 1 |
6 files changed, 2 insertions, 60 deletions
diff --git a/include/media-svc.h b/include/media-svc.h index 271fb95..6d3d065 100755 --- a/include/media-svc.h +++ b/include/media-svc.h @@ -35,7 +35,6 @@ extern "C" { #endif -int media_svc_cleanup_db(sqlite3 *handle, uid_t uid); int media_svc_get_user_version(sqlite3 *handle, int *user_version); int media_svc_create_table(uid_t uid); int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *storage_id, const char *path); diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index 46bb1f6..05175e0 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -28,7 +28,8 @@ int cleanup_db(sqlite3 *handle, uid_t uid) { - return media_svc_cleanup_db(handle, uid); + /* For scanner V2 */ + return MS_MEDIA_ERR_NONE; } int check_item_exist(sqlite3 *handle, const char *storage_id, const char *file_path, bool *modified) diff --git a/src/common/media-svc-db-utils.c b/src/common/media-svc-db-utils.c index 51cb88b..81e460f 100755 --- a/src/common/media-svc-db-utils.c +++ b/src/common/media-svc-db-utils.c @@ -1336,54 +1336,6 @@ int _media_svc_get_user_version(sqlite3 *db_handle, int *user_version) return MS_MEDIA_ERR_NONE; } -int _media_svc_do_cleanup(sqlite3 *db_handle, uid_t uid) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - GList *sql_list = NULL; - int item_cnt = 0; - int idx = 0; - /*Make one query to drop table, delete folder, delete storage.. And only for external USB storage */ - char *sql = sqlite3_mprintf("select 'DROP TABLE ''' || storage_uuid || ''';DELETE FROM folder WHERE storage_uuid = ''' || storage_uuid || ''';DELETE FROM storage WHERE storage_uuid = ''' || storage_uuid || ''';' from storage where validity = 0 AND storage_type=2;"); - - ret = _media_svc_sql_prepare_to_step_simple(db_handle, sql, &sql_stmt); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when get user_version."); - return ret; - } - - while (sqlite3_step(sql_stmt) == SQLITE_ROW) { - if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) - sql_list = g_list_append(sql_list, strdup((char *)sqlite3_column_text(sql_stmt, 0))); - } - - SQLITE3_FINALIZE(sql_stmt); - - if ((sql_list != NULL) && (g_list_length(sql_list) > 0)) { - item_cnt = g_list_length(sql_list); - - for (idx = 0; idx < item_cnt; idx++) { - char *query = NULL; - query = g_list_nth_data(sql_list, idx); - - if (STRING_VALID(query)) { - sql = sqlite3_mprintf("%s", query); - _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - SAFE_FREE(query); - } - } - g_list_free(sql_list); - } - - /*Rebuild index*/ - sql = sqlite3_mprintf("VACUUM;"); - _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - - return MS_MEDIA_ERR_NONE; -} - int _media_svc_sql_prepare_to_step(sqlite3 *handle, const char *sql_str, sqlite3_stmt **stmt) { int err = -1; diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c index 98491de..e79014a 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" -#define FOLDER_SCAN_DONE 4 - 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) diff --git a/src/common/media-svc.c b/src/common/media-svc.c index ca2daff..6bf0a89 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -49,13 +49,6 @@ static __thread int g_insert_with_noti = FALSE; #define BATCH_REQUEST_MAX 300 -int media_svc_cleanup_db(sqlite3 *handle, uid_t uid) -{ - media_svc_debug_fenter(); - - return _media_svc_do_cleanup(handle, uid); -} - int media_svc_get_user_version(sqlite3 *handle, int *user_version) { return _media_svc_get_user_version(handle, user_version); diff --git a/src/include/common/media-svc-db-utils.h b/src/include/common/media-svc-db-utils.h index f9117f8..816b3b8 100755 --- a/src/include/common/media-svc-db-utils.h +++ b/src/include/common/media-svc-db-utils.h @@ -37,7 +37,6 @@ int _media_svc_create_media_table_with_id(const char *table_id, uid_t uid); int _media_svc_update_media_view(sqlite3 *db_handle, uid_t uid); int _media_svc_sql_query(const char *sql_str, uid_t uid); int _media_svc_get_user_version(sqlite3 *db_handle, int *user_version); -int _media_svc_do_cleanup(sqlite3 *db_handle, uid_t uid); 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); |