Modified update_one_extract_item() function to update DB directly.
So there is no need to call query_do_update_list() for update.
This patch only affects media-scanner-v2.
Change-Id: Ic8a834eb1303636fb86f461d40226a2ce7ef2c56
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
typedef int (*CHECK_FOLDER_EXIST)(sqlite3*, const char*, const char*);
typedef int (*GET_EXTRACT_LIST)(sqlite3*, const char*, int, int, const char*, int, uid_t, void*);
typedef int (*UPDATE_ONE_EXTRACT_ITEM)(sqlite3*, const char*, int, void *);
-typedef int (*QUERY_DO_UPDATE_LIST)(sqlite3*);
typedef int (*GET_MEDIA_TYPE)(const char *, int *);
typedef int (*REFRESH_ITEM)(sqlite3 *, const char *, const char *, uid_t);
int ms_get_extract_list(sqlite3 *handle, const char* storage_id, int storage_type, int scan_type, const char* path, int is_end, uid_t uid, void* array);
int ms_update_one_extract_item(sqlite3 *handle, const char* storage_id, int storage_type, void* data);
-int ms_query_do_update_list(sqlite3 *handle);
void ms_batch_commit_enable(bool noti_enable, int pid);
void ms_batch_commit_disable(uid_t uid);
eGET_MEDIA_TYPE,
eGET_EXTRACT_LIST,
eUPDATE_ONE_EXTRACT_ITEM,
- eQUERY_DO_UPDATE_LIST,
eREFRESH_ITEM,
eFUNC_MAX
};
"get_media_type",
"get_extract_list",
"update_one_extract_item",
- "query_do_update_list",
"refresh_item",
};
return ret;
}
-int ms_query_do_update_list(sqlite3 *handle)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((QUERY_DO_UPDATE_LIST)func_array[eQUERY_DO_UPDATE_LIST])(handle); /*dlopen*/
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "QUERY_DO_UPDATE_LIST failed [%d]", ret);
-
- return ret;
-}
-
int ms_delete_invalid_items(sqlite3 *handle, const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
{
MS_DBG_WARN("begin of __msc_folder_bulk_extract");
int ret = MS_MEDIA_ERR_NONE;
- int tmp_ret = MS_MEDIA_ERR_NONE;
GArray *data_array = NULL;
ms_item_info_s* db_data = NULL;
- int extract_count = 0;
int sleep_count = 0;
ret = ms_get_extract_list(handle, storage_id, storage_type, scan_type, path, is_end, uid, (void *)&data_array);
MS_DBG_RETVM_IF(!data_array, MS_MEDIA_ERR_NONE, "data_array is NULL!!!");
while (data_array->len != 0) {
- tmp_ret = MS_MEDIA_ERR_NONE;
db_data = NULL;
ret = __msc_check_extract_stop_status(scan_type, path, pid, is_end);
g_array_remove_index(data_array, 0);
g_mutex_lock(&decode_mutex);
- tmp_ret = ms_update_one_extract_item(handle, storage_id, storage_type, db_data);
+ ms_update_one_extract_item(handle, storage_id, storage_type, db_data);
g_mutex_unlock(&decode_mutex);
- if (tmp_ret == MS_MEDIA_ERR_NONE)
- extract_count++;
if (db_data) {
- MS_SAFE_FREE(db_data->path);
- MS_SAFE_FREE(db_data);
+ g_free(db_data->path);
+ g_free(db_data);
db_data = NULL;
}
}
}
- if (extract_count > 0)
- ms_query_do_update_list(handle);
-
while (data_array->len != 0) {
- db_data = NULL;
db_data = g_array_index(data_array, ms_item_info_s *, 0);
g_array_remove_index(data_array, 0);
if (db_data) {
- MS_SAFE_FREE(db_data->path);
- MS_SAFE_FREE(db_data);
+ g_free(db_data->path);
+ g_free(db_data);
db_data = NULL;
}
}