int media_svc_connect(MediaSvcHandle **handle, uid_t uid, bool need_write);
int media_svc_disconnect(MediaSvcHandle *handle);
int media_svc_get_user_version(MediaSvcHandle *handle, int *user_version);
-int media_svc_create_table(MediaSvcHandle *handle, uid_t uid);
+int media_svc_create_table(uid_t uid);
int media_svc_check_item_exist_by_path(MediaSvcHandle *handle, const char *storage_id, const char *path);
int media_svc_insert_folder(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
-int media_svc_insert_item_begin(MediaSvcHandle *handle, int with_noti, int data_cnt, int from_pid);
-int media_svc_insert_item_end(MediaSvcHandle *handle, uid_t uid);
+int media_svc_insert_item_begin(int with_noti, int data_cnt, int from_pid);
+int media_svc_insert_item_end(uid_t uid);
int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, int is_burst, uid_t uid);
int media_svc_insert_item_immediately(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e src_storage, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, uid_t uid);
-int media_svc_set_item_validity_begin(MediaSvcHandle *handle, int data_cnt);
-int media_svc_set_item_validity_end(MediaSvcHandle *handle, uid_t uid);
-int media_svc_set_item_validity(MediaSvcHandle *handle, const char *storage_id, const char *path, int validity, uid_t uid);
+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(MediaSvcHandle *handle, const char *storage_id, const char *path, uid_t uid);
-int media_svc_delete_all_items_in_storage(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
+int media_svc_delete_all_items_in_storage(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
int media_svc_delete_invalid_items_in_storage(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid);
-int media_svc_set_all_storage_items_validity(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid);
+int media_svc_set_all_storage_items_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid);
int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid);
int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, const char *src_path, const char *dst_path, uid_t uid);
int media_svc_check_db_corrupt(MediaSvcHandle *handle);
int media_svc_get_folder_list(MediaSvcHandle *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int **item_num_list, int *count);
int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid);
-int media_svc_publish_noti(MediaSvcHandle *handle, media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
-int media_svc_get_pinyin(MediaSvcHandle *handle, const char *src_str, char **pinyin_str);
+int media_svc_publish_noti(media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
+int media_svc_get_pinyin(const char *src_str, char **pinyin_str);
int media_svc_check_pinyin_support(bool *support);
-int media_svc_update_item_begin(MediaSvcHandle *handle, int data_cnt);
-int media_svc_update_item_end(MediaSvcHandle *handle, uid_t uid);
+int media_svc_update_item_begin(int data_cnt);
+int media_svc_update_item_end(uid_t uid);
int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, int storage_type, uid_t uid);
int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_svc_content_info_s *content_info, uid_t uid);
void media_svc_destroy_content_info(media_svc_content_info_s *content_info);
int media_svc_get_storage_id(MediaSvcHandle *handle, const char *path, char *storage_id);
int media_svc_get_storage_path(MediaSvcHandle *handle, const char *storage_uuid, char **storage_path);
int media_svc_get_storage_scan_status(MediaSvcHandle *handle, const char *storage_uuid, media_svc_scan_status_type_e *storage_status);
-int media_svc_set_storage_scan_status(MediaSvcHandle *handle, const char *storage_uuid, media_svc_scan_status_type_e storage_status, uid_t uid);
+int media_svc_set_storage_scan_status(const char *storage_uuid, media_svc_scan_status_type_e storage_status, uid_t uid);
int media_svc_get_storage_list(MediaSvcHandle *handle, char ***storage_list, char ***storage_id_list, int **scan_status_list, int *count);
-int media_svc_delete_invalid_folder(MediaSvcHandle *handle, const char *storage_id, uid_t uid);
+int media_svc_delete_invalid_folder(const char *storage_id, uid_t uid);
int media_svc_set_folder_validity(MediaSvcHandle *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid);
int media_svc_insert_item_pass1(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, int is_burst, uid_t uid);
int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, int scan_type, const char* extract_path, int is_burst, uid_t uid);
-int media_svc_insert_folder_begin(MediaSvcHandle *handle, int data_cnt);
-int media_svc_insert_folder_end(MediaSvcHandle *handle, uid_t uid);
+int media_svc_insert_folder_begin(int data_cnt);
+int media_svc_insert_folder_end(uid_t uid);
int media_svc_delete_invalid_folder_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count);
int media_svc_check_folder_exist_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path);
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_insert_item_begin(handle, item_cnt, with_noti, from_pid);
+ ret = media_svc_insert_item_begin(item_cnt, with_noti, from_pid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_insert_item_end(handle, uid);
+ ret = media_svc_insert_item_end(uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
if (!STORAGE_VALID(storage_type)) {
__set_error_message(ERR_STORAGE_TYPE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
- ret = media_svc_set_all_storage_items_validity(handle, storage_id, storage_type, validity, uid);
+ ret = media_svc_set_all_storage_items_validity(storage_id, storage_type, validity, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_set_item_validity_begin(handle, item_cnt);
+ ret = media_svc_set_item_validity_begin(item_cnt);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_set_item_validity_end(handle, uid);
+ ret = media_svc_set_item_validity_end(uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
if (!STRING_VALID(file_path)) {
__set_error_message(ERR_FILE_PATH, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
- ret = media_svc_set_item_validity(handle, storage_id, file_path, validity, uid);
+ ret = media_svc_set_item_validity(storage_id, file_path, validity, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
if (!STORAGE_VALID(storage_type)) {
__set_error_message(ERR_STORAGE_TYPE, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
}
- ret = media_svc_delete_all_items_in_storage(handle, storage_id, storage_type, uid);
+ ret = media_svc_delete_all_items_in_storage(storage_id, storage_type, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
if (user_version == 0) {
/*check db schema*/
- ret = media_svc_create_table(handle, uid);
+ ret = media_svc_create_table(uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
ret = media_svc_generate_uuid(uuid);
if (ret < 0) {
__set_error_message(ret, err_msg);
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
media_svc_scan_status_type_e storage_status = status;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_set_storage_scan_status(handle, storage_id, storage_status, uid);
+ ret = media_svc_set_storage_scan_status(storage_id, storage_status, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_update_item_begin(handle, item_cnt);
+ ret = media_svc_update_item_begin(item_cnt);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_update_item_end(handle, uid);
+ ret = media_svc_update_item_end(uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_insert_folder_begin(handle, item_cnt);
+ ret = media_svc_insert_folder_begin(item_cnt);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_insert_folder_end(handle, uid);
+ ret = media_svc_insert_folder_end(uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
{
int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_delete_invalid_folder(handle, storage_id, uid);
+ ret = media_svc_delete_invalid_folder(storage_id, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
char *sql = sqlite3_mprintf("INSERT INTO %s (name, artist, album_art, album_art) values (%Q, %Q, %Q, %Q); ",
MEDIA_SVC_DB_TABLE_ALBUM, album, artist, album_art, album_art);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*drop playlist_view, tag_view */
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_DROP_VIEW, MEDIA_SVC_DB_VIEW_PLAYLIST);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_DROP_VIEW, MEDIA_SVC_DB_VIEW_TAG);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
memset(temp, 0, sizeof(temp));
}
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_VIEW_PLAYLIST, MEDIA_SVC_DB_VIEW_PLAYLIST, table_query);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
memset(temp, 0, sizeof(temp));
}
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_VIEW_TAG, MEDIA_SVC_DB_VIEW_TAG, table_query);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid)
+int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e list, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
table_info_s *tb = NULL;
/*send queries */
if (table_sub_len > 0) {
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_TABLE_WITH_UNIQUE, table_name, table_query, table_query_sub);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
memset(table_query, 0, sizeof(table_query));
memset(table_query_sub, 0, sizeof(table_query_sub));
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
} else {
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_TABLE, table_name, table_query);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
memset(table_query, 0, sizeof(table_query));
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
}
if (index_len > 0) {
- ret = _media_svc_sql_query(db_handle, index_query, uid);
+ ret = _media_svc_sql_query(index_query, uid);
memset(index_query, 0, sizeof(index_query));
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
}
if (trigger_len > 0) {
- ret = _media_svc_sql_query(db_handle, trigger_query, uid);
+ ret = _media_svc_sql_query(trigger_query, uid);
memset(trigger_query, 0, sizeof(trigger_query));
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
}
if (tb != NULL && tb->view_name != NULL) {
if (strncmp(table_name, MEDIA_SVC_DB_TABLE_MEDIA, strlen(MEDIA_SVC_DB_TABLE_MEDIA)) == 0) {
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_VIEW_MEDIA, tb->view_name, table_name);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
memset(temp, 0, sizeof(temp));
}
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_VIEW_PLAYLIST, tb->view_name, table_query);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
memset(temp, 0, sizeof(temp));
}
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_VIEW_TAG, tb->view_name, table_query);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
else
snprintf(temp, sizeof(temp), "%s %s", col_ptr->name, col_ptr->type);
sql = sqlite3_mprintf(MEDIA_SVC_DB_QUERY_ALTER_TABLE, table_name, temp);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*create index */
if (col_ptr->is_index) {
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_INDEX, col_ptr->index_name, table_name, col_ptr->name);
- ret = _media_svc_sql_query(db_handle, temp, uid);
+ ret = _media_svc_sql_query(temp, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
}
}
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("Error when create backup folder table");
SQLITE3_SAFE_FREE(sql);
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("Error when drop table");
SQLITE3_SAFE_FREE(sql);
/* Create new table */
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("Error when backup folder table");
SQLITE3_SAFE_FREE(sql);
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("Error when drop backup folder table");
SQLITE3_SAFE_FREE(sql);
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
SQLITE3_SAFE_FREE(sql);
sql = sqlite3_mprintf("UPDATE %q SET storage_uuid = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, "media");
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
SQLITE3_SAFE_FREE(sql);
}
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
SQLITE3_SAFE_FREE(sql);
_media_svc_destroy_table_query();
return ret;
}
-int _media_svc_sql_query(sqlite3 *db_handle, const char *sql_str, uid_t uid)
+int _media_svc_sql_query(const char *sql_str, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_sql_begin_trans(sqlite3 *handle, uid_t uid)
+int _media_svc_sql_begin_trans(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int _media_svc_sql_end_trans(sqlite3 *handle, uid_t uid)
+int _media_svc_sql_end_trans(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int _media_svc_sql_rollback_trans(sqlite3 *handle, uid_t uid)
+int _media_svc_sql_rollback_trans(uid_t uid)
{
media_svc_error("========_media_svc_sql_rollback_trans");
- return _media_svc_sql_query(handle, "ROLLBACK;", uid);
+ return _media_svc_sql_query("ROLLBACK;", uid);
}
-int _media_svc_sql_query_list(sqlite3 *handle, GList **query_list, uid_t uid)
+int _media_svc_sql_query_list(GList **query_list, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
int idx = 0;
}
-int _media_svc_create_media_table_with_id(sqlite3 *db_handle, const char *table_id, uid_t uid)
+int _media_svc_create_media_table_with_id(const char *table_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, table_id, MEDIA_SVC_DB_LIST_MEDIA, uid);
+ ret = _media_svc_make_table_query(table_id, MEDIA_SVC_DB_LIST_MEDIA, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
}
/* Add for trigger */
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, MEDIA_SVC_DB_LIST_PLAYLIST_MAP, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, MEDIA_SVC_DB_LIST_PLAYLIST_MAP, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_ALBUM, MEDIA_SVC_DB_LIST_ALBUM, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_ALBUM, MEDIA_SVC_DB_LIST_ALBUM, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_TAG_MAP, MEDIA_SVC_DB_LIST_TAG_MAP, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_TAG_MAP, MEDIA_SVC_DB_LIST_TAG_MAP, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_BOOKMARK, MEDIA_SVC_DB_LIST_BOOKMARK, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_BOOKMARK, MEDIA_SVC_DB_LIST_BOOKMARK, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query failed");
goto ERROR;
return ret;
}
-int _media_svc_drop_media_table(sqlite3 *handle, const char *storage_id, uid_t uid)
+int _media_svc_drop_media_table(const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("DROP TABLE IF EXISTS '%q'", storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
g_list_free(storage_list);
}
- ret = _media_svc_sql_query(db_handle, view_query, uid);
+ ret = _media_svc_sql_query(view_query, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return ret;
sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, storage_id, folder_name);
else
sql = sqlite3_mprintf("UPDATE %q SET parent_folder_uuid = '%q' WHERE path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, parent_folder_uuid, folder_name);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
media_svc_error("error when get parent folder uuid");
return ret;
}
-static int __media_svc_append_folder(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type,
+static int __media_svc_append_folder(const char *storage_id, media_svc_storage_type_e storage_type,
const char *folder_id, const char *folder_path, const char *parent_folder_uuid, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
MEDIA_SVC_DB_TABLE_FOLDER, folder_id, folder_path, folder_name, storage_id, storage_type, folder_modified_date, folder_name_pinyin, parent_folder_uuid);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
_media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql);
return ret;
}
-int _media_svc_update_folder_modified_time_by_folder_uuid(sqlite3 *handle, const char *folder_uuid, const char *folder_path, bool stack_query, uid_t uid)
+int _media_svc_update_folder_modified_time_by_folder_uuid(const char *folder_uuid, const char *folder_path, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
int modified_time = 0;
char *sql = sqlite3_mprintf("UPDATE %s SET modified_time=%d WHERE folder_uuid=%Q;", MEDIA_SVC_DB_TABLE_FOLDER, modified_time, folder_uuid);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
_media_svc_sql_query_add(&g_media_svc_move_item_query_list, &sql);
return MS_MEDIA_ERR_INTERNAL;
}
- ret = __media_svc_append_folder(handle, storage_id, storage_type, folder_uuid, dir_path, parent_folder_uuid, FALSE, uid);
+ ret = __media_svc_append_folder(storage_id, storage_type, folder_uuid, dir_path, parent_folder_uuid, FALSE, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("__media_svc_append_folder is failed");
}
return ret;
}
-int _media_svc_update_folder_table(sqlite3 *handle, const char *storage_id, uid_t uid)
+int _media_svc_update_folder_table(const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE folder_uuid IN (SELECT folder_uuid FROM '%s' WHERE folder_uuid NOT IN (SELECT folder_uuid FROM '%s'));",
MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_TABLE_FOLDER, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
return MS_MEDIA_ERR_INTERNAL;
}
- ret = __media_svc_append_folder(handle, storage_id, storage_type, folder_uuid, path_name, parent_folder_uuid, stack_query, uid);
+ ret = __media_svc_append_folder(storage_id, storage_type, folder_uuid, path_name, parent_folder_uuid, stack_query, uid);
_strncpy_safe(folder_id, folder_uuid, MEDIA_SVC_UUID_SIZE+1);
sql = sqlite3_mprintf("UPDATE '%s' SET validity=1 WHERE storage_uuid = '%q' AND path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, path);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
_media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql);
return ret;
}
-int _media_svc_delete_invalid_folder(sqlite3 *handle, const char *storage_id, uid_t uid)
+int _media_svc_delete_invalid_folder(const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid = '%q' AND validity = 0;", MEDIA_SVC_DB_TABLE_FOLDER, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
MEDIA_SVC_DB_TABLE_FOLDER, validity, storage_id, start_path);
}
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_delete_folder_by_storage_id(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
+int _media_svc_delete_folder_by_storage_id(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid = '%q' AND storage_type = %d;", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, storage_type);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
/*delete invalid folder*/
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE (storage_uuid = '%q' AND validity = 0 AND PATH LIKE '%q%%');", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, folder_path);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
}
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("failed to insert item");
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_update_meta_with_data(sqlite3 *handle, media_svc_content_info_s *content_info)
+int _media_svc_update_meta_with_data(media_svc_content_info_s *content_info)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int _media_svc_update_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, uid_t uid)
+int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
content_info->path
);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, bool stack_query, uid_t uid)
+int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("DELETE FROM '%s' WHERE path='%q';", storage_id, path);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("failed to delete item");
return ret;
}
-int _media_svc_truncate_table(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
+int _media_svc_truncate_table(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("DELETE FROM '%s' where storage_type=%d;", storage_id, storage_type);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
char *sql = sqlite3_mprintf("DELETE FROM '%s' WHERE validity = 0;", storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
SAFE_FREE(thumbpath_record);
else
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE validity = 0 AND folder_uuid='%q';", storage_id, folder_uuid);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
SAFE_FREE(thumbpath_record);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_update_item_validity(sqlite3 *handle, const char *storage_id, const char *path, int validity, bool stack_query, 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 ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE path= '%q';", storage_id, validity, path);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
_media_svc_sql_query_add(&g_media_svc_item_validity_query_list, &sql);
return ret;
}
-int _media_svc_update_thumbnail_path(sqlite3 *handle, const char *storage_id, const char *path, const char *thumb_path, uid_t uid)
+int _media_svc_update_thumbnail_path(const char *storage_id, const char *path, const char *thumb_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("UPDATE '%s' SET thumbnail_path=%Q WHERE path= %Q;", storage_id, thumb_path, path);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_update_storage_item_validity(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid)
+int _media_svc_update_storage_item_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE storage_type=%d;", storage_id, validity, storage_type);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
/*Update folder item validity*/
sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE folder_uuid='%q';", storage_id, validity, folder_uuid);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_update_recursive_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 ret = MS_MEDIA_ERR_NONE;
/*Update folder item validity*/
char *sql = sqlite3_mprintf("UPDATE '%s' 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(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_update_item_by_path(sqlite3 *handle, const char *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path,
+int _media_svc_update_item_by_path(const char *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path,
const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid)
{
/* update path, filename, modified_time, folder_uuid, thumbnail_path, */
}
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
} else {
_media_svc_sql_query_add(&g_media_svc_move_item_query_list, &sql);
return ret;
}
-int _media_svc_list_query_do(sqlite3 *handle, media_svc_query_type_e query_type, uid_t uid)
+int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = _media_svc_sql_begin_trans(handle, uid);
+ ret = _media_svc_sql_begin_trans(uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
if (query_type == MEDIA_SVC_QUERY_SET_ITEM_VALIDITY)
- ret = _media_svc_sql_query_list(handle, &g_media_svc_item_validity_query_list, uid);
+ ret = _media_svc_sql_query_list(&g_media_svc_item_validity_query_list, uid);
else if (query_type == MEDIA_SVC_QUERY_MOVE_ITEM)
- ret = _media_svc_sql_query_list(handle, &g_media_svc_move_item_query_list, uid);
+ ret = _media_svc_sql_query_list(&g_media_svc_move_item_query_list, uid);
else if (query_type == MEDIA_SVC_QUERY_INSERT_ITEM)
- ret = _media_svc_sql_query_list(handle, &g_media_svc_insert_item_query_list, uid);
+ ret = _media_svc_sql_query_list(&g_media_svc_insert_item_query_list, uid);
else if (query_type == MEDIA_SVC_QUERY_UPDATE_ITEM)
- ret = _media_svc_sql_query_list(handle, &g_media_svc_update_item_query_list, uid);
+ ret = _media_svc_sql_query_list(&g_media_svc_update_item_query_list, uid);
else if (query_type == MEDIA_SVC_QUERY_INSERT_FOLDER)
- ret = _media_svc_sql_query_list(handle, _media_svc_get_folder_list_ptr(), uid);
+ ret = _media_svc_sql_query_list(_media_svc_get_folder_list_ptr(), uid);
else if (query_type == MEDIA_SVC_QUERY_UPDATE_COMMON)
- ret = _media_svc_sql_query_list(handle, &g_media_svc_update_list, uid);
+ ret = _media_svc_sql_query_list(&g_media_svc_update_list, uid);
else
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_list_query_do failed. start rollback");
- _media_svc_sql_rollback_trans(handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
- ret = _media_svc_sql_end_trans(handle, uid);
+ ret = _media_svc_sql_end_trans(uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("mb_svc_sqlite3_commit_trans failed.. Now start to rollback");
- _media_svc_sql_rollback_trans(handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
g_media_svc_update_list_count++;
if (g_media_svc_update_list_count >= MEDIA_SVC_MAX_COMMIT_SIZE) {
- ret = _media_svc_list_query_do(NULL, MEDIA_SVC_QUERY_UPDATE_COMMON, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_COMMON, uid);
g_media_svc_update_list_count = 0;
}
media_svc_debug("MAKE PASS 1 QUERY END");
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("failed to insert item");
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_insert_item_pass2(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid)
+int _media_svc_insert_item_pass2(const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
);
if (!stack_query) {
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
if (ret != MS_MEDIA_ERR_NONE) {
sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_type) VALUES ('%s', '%s', '%s', 0);",
MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_TABLE_MEDIA, internal_path);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
SAFE_FREE(internal_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_append_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, const char *storage_path, const char *storage_account, media_svc_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_storage(const char *storage_id, const char *storage_name, const char *storage_path, const char *storage_account, media_svc_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = sqlite3_mprintf("INSERT INTO %s (storage_uuid, storage_name, storage_path, storage_account, storage_type) values (%Q, %Q, %Q, %Q, %d); ",
MEDIA_SVC_DB_TABLE_STORAGE, storage_id, storage_name, storage_path, storage_account, storage_type);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
/*Storage table update*/
sql = sqlite3_mprintf("UPDATE '%s' SET storage_path=%Q WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_STORAGE, path, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*Folder table update*/
sql = sqlite3_mprintf("UPDATE '%s' SET path=REPLACE(path, %Q, %Q) WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_FOLDER, old_storage_path, path, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*Media table update*/
sql = sqlite3_mprintf("UPDATE '%s' SET path=REPLACE(path, %Q, %Q);", storage_id, old_storage_path, path);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return ret;
}
-int _media_svc_delete_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, uid_t uid)
+int _media_svc_delete_storage(const char *storage_id, const char *storage_name, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
else if (storage_id != NULL)
sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
}
-int _media_svc_update_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid)
+int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
else
sql = sqlite3_mprintf("UPDATE '%s' SET validity=%d WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_STORAGE, validity, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
return ret;
}
-int _media_svc_set_storage_scan_status(sqlite3 *handle, const char *storage_id, media_svc_scan_status_type_e scan_status, uid_t uid)
+int _media_svc_set_storage_scan_status(const char *storage_id, media_svc_scan_status_type_e scan_status, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
else
sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE storage_uuid=%Q;", MEDIA_SVC_DB_TABLE_STORAGE, scan_status, storage_id);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
return _media_svc_get_user_version(db_handle, user_version);
}
-int media_svc_create_table(MediaSvcHandle *handle, uid_t uid)
+int media_svc_create_table(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
char *sql = NULL;
media_svc_debug_fenter();
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
ret = _media_svc_init_table_query(MEDIA_SVC_DB_TABLE_MEDIA);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_init_table_query fail.");
}
/*create media table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_LIST_MEDIA, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_DB_LIST_MEDIA, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create folder table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FOLDER, MEDIA_SVC_DB_LIST_FOLDER, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create playlist_map table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, MEDIA_SVC_DB_LIST_PLAYLIST_MAP, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_PLAYLIST_MAP, MEDIA_SVC_DB_LIST_PLAYLIST_MAP, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create playlist table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_PLAYLIST, MEDIA_SVC_DB_LIST_PLAYLIST, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_PLAYLIST, MEDIA_SVC_DB_LIST_PLAYLIST, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/* create album table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_ALBUM, MEDIA_SVC_DB_LIST_ALBUM, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_ALBUM, MEDIA_SVC_DB_LIST_ALBUM, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create tag_map table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_TAG_MAP, MEDIA_SVC_DB_LIST_TAG_MAP, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_TAG_MAP, MEDIA_SVC_DB_LIST_TAG_MAP, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create tag table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_TAG, MEDIA_SVC_DB_LIST_TAG, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_TAG, MEDIA_SVC_DB_LIST_TAG, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create bookmark table*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_BOOKMARK, MEDIA_SVC_DB_LIST_BOOKMARK, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_BOOKMARK, MEDIA_SVC_DB_LIST_BOOKMARK, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
/*create storage table. from tizen 2.4*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_LIST_STORAGE, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_STORAGE, MEDIA_SVC_DB_LIST_STORAGE, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
#endif
/*create face table. from tizen 3.0*/
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_FACE_SCAN_LIST, MEDIA_SVC_DB_LIST_FACE_SCAN_LIST, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FACE_SCAN_LIST, MEDIA_SVC_DB_LIST_FACE_SCAN_LIST, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
- ret = _media_svc_make_table_query(db_handle, MEDIA_SVC_DB_TABLE_FACE, MEDIA_SVC_DB_LIST_FACE, uid);
+ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FACE, MEDIA_SVC_DB_LIST_FACE, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_make_table_query fail.");
goto ERROR;
}
sql = sqlite3_mprintf("pragma user_version = %d;", LATEST_VERSION_NUMBER);
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("user_version update fail.");
goto ERROR;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_insert_item_begin(MediaSvcHandle *handle, int data_cnt, int with_noti, int from_pid)
+int media_svc_insert_item_begin(int data_cnt, int with_noti, int from_pid)
{
- sqlite3 *db_handle = (sqlite3 *)handle;
-
media_svc_debug("Transaction data count : [%d]", data_cnt);
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
g_media_svc_insert_item_data_cnt = data_cnt;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_insert_item_end(MediaSvcHandle *handle, uid_t uid)
+int media_svc_insert_item_end(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
media_svc_debug_fenter();
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
if (g_media_svc_insert_item_cur_data_cnt > 0) {
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_ITEM, uid);
if (g_insert_with_noti) {
media_svc_debug("sending noti list");
_media_svc_publish_noti_list(g_media_svc_insert_item_cur_data_cnt);
if (g_insert_with_noti)
_media_svc_insert_item_to_noti_list(&content_info, g_media_svc_insert_item_cur_data_cnt);
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_ITEM, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti) {
/*update item*/
if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid);
} else {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid);
}
SAFE_FREE(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*update folder modified_time*/
folder_path = g_path_get_dirname(dest_path);
- ret = _media_svc_update_folder_modified_time_by_folder_uuid(db_handle, folder_uuid, folder_path, FALSE, uid);
+ ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, FALSE, uid);
SAFE_FREE(folder_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = _media_svc_update_folder_table(db_handle, storage_id, uid);
+ ret = _media_svc_update_folder_table(storage_id, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
} else if (g_media_svc_move_item_cur_data_cnt < (g_media_svc_move_item_data_cnt - 1)) {
/*update item*/
if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
} else {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
}
SAFE_FREE(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*update folder modified_time*/
folder_path = g_path_get_dirname(dest_path);
- ret = _media_svc_update_folder_modified_time_by_folder_uuid(db_handle, folder_uuid, folder_path, TRUE, uid);
+ ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, TRUE, uid);
SAFE_FREE(folder_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*update item*/
if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid);
} else {
- ret = _media_svc_update_item_by_path(db_handle, storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
+ ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid);
}
SAFE_FREE(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*update folder modified_time*/
folder_path = g_path_get_dirname(dest_path);
- ret = _media_svc_update_folder_modified_time_by_folder_uuid(db_handle, folder_uuid, folder_path, TRUE, uid);
+ ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, TRUE, uid);
SAFE_FREE(folder_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*update db*/
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_MOVE_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_MOVE_ITEM, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
g_media_svc_move_item_cur_data_cnt = 0;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_set_item_validity_begin(MediaSvcHandle *handle, int data_cnt)
+int media_svc_set_item_validity_begin(int data_cnt)
{
- sqlite3 *db_handle = (sqlite3 *)handle;
-
media_svc_debug("Transaction data count : [%d]", data_cnt);
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
g_media_svc_item_validity_data_cnt = data_cnt;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_set_item_validity_end(MediaSvcHandle *handle, uid_t uid)
+int media_svc_set_item_validity_end(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
media_svc_debug_fenter();
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
if (g_media_svc_item_validity_cur_data_cnt > 0) {
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
}
g_media_svc_item_validity_data_cnt = 1;
return ret;
}
-int media_svc_set_item_validity(MediaSvcHandle *handle, const char *storage_id, const char *path, int validity, uid_t uid)
+int media_svc_set_item_validity(const char *storage_id, const char *path, int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
- media_svc_retvm_if(db_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");
if (g_media_svc_item_validity_data_cnt == 1) {
- return _media_svc_update_item_validity(db_handle, storage_id, path, validity, FALSE, uid);
+ return _media_svc_update_item_validity(storage_id, path, validity, FALSE, uid);
} else if (g_media_svc_item_validity_cur_data_cnt < (g_media_svc_item_validity_data_cnt - 1)) {
- ret = _media_svc_update_item_validity(db_handle, storage_id, path, validity, TRUE, uid);
+ ret = _media_svc_update_item_validity(storage_id, path, validity, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
g_media_svc_item_validity_cur_data_cnt++;
} else if (g_media_svc_item_validity_cur_data_cnt == (g_media_svc_item_validity_data_cnt - 1)) {
- ret = _media_svc_update_item_validity(db_handle, storage_id, path, validity, TRUE, uid);
+ ret = _media_svc_update_item_validity(storage_id, path, validity, TRUE, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
g_media_svc_item_validity_cur_data_cnt = 0;
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*Delete item*/
- ret = _media_svc_delete_item_by_path(db_handle, storage_id, path, FALSE, uid);
+ ret = _media_svc_delete_item_by_path(storage_id, path, FALSE, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_delete_item_by_path failed : %d", ret);
_media_svc_destroy_noti_item(noti_item);
_media_svc_publish_noti(MS_MEDIA_ITEM_FILE, MS_MEDIA_ITEM_DELETE, path, media_type, noti_item->media_uuid, noti_item->mime_type);
_media_svc_destroy_noti_item(noti_item);
} else {
- ret = _media_svc_delete_item_by_path(db_handle, storage_id, path, TRUE, uid);
+ ret = _media_svc_delete_item_by_path(storage_id, path, TRUE, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("_media_svc_delete_item_by_path failed : %d", ret);
return ret;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_delete_all_items_in_storage(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
+int media_svc_delete_all_items_in_storage(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
media_svc_debug("media_svc_delete_all_items_in_storage [%d]", storage_type);
- media_svc_retvm_if(db_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(__media_svc_check_storage(storage_type, FALSE) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- ret = _media_svc_truncate_table(db_handle, storage_id, storage_type, uid);
+ ret = _media_svc_truncate_table(storage_id, storage_type, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
if (storage_type != MEDIA_SVC_STORAGE_EXTERNAL_USB) {
return _media_svc_delete_invalid_folder_items(db_handle, storage_id, folder_path, is_recursive, uid);
}
-int media_svc_set_all_storage_items_validity(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid)
+int media_svc_set_all_storage_items_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid)
{
- sqlite3 *db_handle = (sqlite3 *)handle;
-
- media_svc_retvm_if(db_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(__media_svc_check_storage(storage_type, FALSE) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- return _media_svc_update_storage_item_validity(db_handle, storage_id, storage_type, validity, uid);
+ return _media_svc_update_storage_item_validity(storage_id, storage_type, validity, uid);
}
int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid)
media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "folder_path is NULL");
if (recursive)
- return _media_svc_update_recursive_folder_item_validity(db_handle, storage_id, folder_path, validity, uid);
+ return _media_svc_update_recursive_folder_item_validity(storage_id, folder_path, validity, uid);
else
return _media_svc_update_folder_item_validity(db_handle, storage_id, folder_path, validity, uid);
}
}
}
- ret = _media_svc_update_thumbnail_path(db_handle, storage_id, path, NULL, uid);
+ ret = _media_svc_update_thumbnail_path(storage_id, path, NULL, uid);
if (ret != MS_MEDIA_ERR_NONE) {
_media_svc_destroy_content_info(&content_info);
return ret;
#endif
- ret = _media_svc_update_item_with_data(db_handle, storage_id, &content_info, uid);
+ ret = _media_svc_update_item_with_data(storage_id, &content_info, uid);
if (ret == MS_MEDIA_ERR_NONE) {
media_svc_debug("Update is successful. Sending noti for this");
media_svc_debug("Src path : %s, Dst Path : %s", src_path, dst_path);
- ret = _media_svc_sql_begin_trans(db_handle, uid);
+ ret = _media_svc_sql_begin_trans(uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/* Update all folder record's modified date, which are changed above */
update_folder_modified_time_sql = sqlite3_mprintf("UPDATE folder SET modified_time = %d WHERE path LIKE '%q';", date, dst_path);
ret = media_db_request_update_db_batch(update_folder_modified_time_sql, uid);
- //ret = _media_svc_sql_query(db_handle, update_folder_modified_time_sql, uid);
sqlite3_free(update_folder_modified_time_sql);
if (ret != SQLITE_OK) {
media_svc_error("failed to update folder modified time");
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return MS_MEDIA_ERR_DB_INTERNAL;
}
ret = _media_svc_sql_prepare_to_step_simple(db_handle, select_all_sql, &sql_stmt);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("error when media_svc_rename_folder. err = [%d]", ret);
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
if (replaced_path == NULL) {
media_svc_error("_media_svc_replace_path failed");
SQLITE3_FINALIZE(sql_stmt);
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return MS_MEDIA_ERR_INTERNAL;
}
media_svc_error("_media_svc_get_storage_type_by_path failed : %d", ret);
SAFE_FREE(replaced_path);
SAFE_FREE(default_thumbnail_path);
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
SAFE_FREE(replaced_path);
SAFE_FREE(default_thumbnail_path);
SQLITE3_FINALIZE(sql_stmt);
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
}
}
ret = media_db_request_update_db_batch(update_item_sql, uid);
- /*ret = _media_svc_sql_query(db_handle, update_item_sql, uid); */
sqlite3_free(update_item_sql);
SAFE_FREE(replaced_path);
if (ret != SQLITE_OK) {
media_svc_error("failed to update item");
SQLITE3_FINALIZE(sql_stmt);
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return MS_MEDIA_ERR_DB_INTERNAL;
}
SQLITE3_FINALIZE(sql_stmt);
- ret = _media_svc_sql_end_trans(db_handle, uid);
+ ret = _media_svc_sql_end_trans(uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("mb_svc_sqlite3_commit_trans failed.. Now start to rollback");
- _media_svc_sql_rollback_trans(db_handle, uid);
+ _media_svc_sql_rollback_trans(uid);
return ret;
}
{
media_svc_retvm_if(!STRING_VALID(db_query), MS_MEDIA_ERR_INVALID_PARAMETER, "db_query is NULL");
- return _media_svc_sql_query(NULL, db_query, uid);
+ return _media_svc_sql_query(db_query, uid);
}
int media_svc_send_dir_update_noti(MediaSvcHandle *handle, const char *storage_id, const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid)
ret = _media_svc_get_folder_info_by_foldername(db_handle, storage_id, folder_path, folder_uuid, &sto_time);
if (ret == MS_MEDIA_ERR_NONE) {
if (sto_time != cur_time) {
- ret = _media_svc_update_folder_modified_time_by_folder_uuid(db_handle, folder_uuid, folder_path, FALSE, uid);
+ ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, FALSE, uid);
}
}
return ret;
}
-int media_svc_update_item_begin(MediaSvcHandle *handle, int data_cnt)
+int media_svc_update_item_begin(int data_cnt)
{
- sqlite3 *db_handle = (sqlite3 *)handle;
-
media_svc_debug("Transaction data count : [%d]", data_cnt);
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(data_cnt < 1, MS_MEDIA_ERR_INVALID_PARAMETER, "data_cnt shuld be bigger than 1");
g_media_svc_update_item_data_cnt = data_cnt;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_update_item_end(MediaSvcHandle *handle, uid_t uid)
+int media_svc_update_item_end(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
media_svc_debug_fenter();
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
if (g_media_svc_update_item_cur_data_cnt > 0) {
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
}
g_media_svc_update_item_data_cnt = 1;
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_media_type_e media_type;
-
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(!STRING_VALID(file_path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
media_svc_retvm_if(__media_svc_check_storage(storage_type, FALSE) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
if (g_media_svc_update_item_data_cnt == 1) {
- ret = _media_svc_update_meta_with_data(db_handle, &content_info);
+ ret = _media_svc_update_meta_with_data(&content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
} else if (g_media_svc_update_item_cur_data_cnt < (g_media_svc_update_item_data_cnt - 1)) {
- ret = _media_svc_update_meta_with_data(db_handle, &content_info);
+ ret = _media_svc_update_meta_with_data(&content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
g_media_svc_update_item_cur_data_cnt++;
} else if (g_media_svc_update_item_cur_data_cnt == (g_media_svc_update_item_data_cnt - 1)) {
- ret = _media_svc_update_meta_with_data(db_handle, &content_info);
+ ret = _media_svc_update_meta_with_data(&content_info);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
g_media_svc_update_item_cur_data_cnt = 0;
return ret;
}
-int media_svc_publish_noti(MediaSvcHandle *handle, media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type)
+int media_svc_publish_noti(media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type)
{
return _media_svc_publish_noti(update_item, update_type, path, media_type, uuid, mime_type);
}
-int media_svc_get_pinyin(MediaSvcHandle *handle, const char *src_str, char **pinyin_str)
+int media_svc_get_pinyin(const char *src_str, char **pinyin_str)
{
media_svc_retvm_if(!STRING_VALID(src_str), MS_MEDIA_ERR_INVALID_PARAMETER, "String is NULL");
media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- ret = _media_svc_update_storage_validity(db_handle, storage_id, validity, uid);
+ ret = _media_svc_update_storage_validity(storage_id, validity, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "update storage validity failed: %d", ret);
ret = _media_svc_update_media_view(db_handle, uid);
return ret;
}
-int media_svc_set_storage_scan_status(MediaSvcHandle *handle, const char *storage_uuid, media_svc_scan_status_type_e storage_status, uid_t uid)
+int media_svc_set_storage_scan_status(const char *storage_uuid, media_svc_scan_status_type_e storage_status, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 * db_handle = (sqlite3 *)handle;
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
- ret = _media_svc_set_storage_scan_status(db_handle, storage_uuid, storage_status, uid);
+ ret = _media_svc_set_storage_scan_status(storage_uuid, storage_status, uid);
return ret;
}
media_svc_retvm_if(storage_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
media_svc_retvm_if(__media_svc_check_storage(storage_type, TRUE) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- ret = _media_svc_append_storage(db_handle, storage_id, storage_name, storage_path, storage_account, storage_type, uid);
+ ret = _media_svc_append_storage(storage_id, storage_name, storage_path, storage_account, storage_type, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "append storage failed : %d", ret);
if (strcmp(storage_id, MEDIA_SVC_DB_TABLE_MEDIA)) {
- ret = _media_svc_create_media_table_with_id(db_handle, storage_id, uid);
+ ret = _media_svc_create_media_table_with_id(storage_id, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "create media table failed : %d", ret);
ret = _media_svc_update_media_view(db_handle, uid);
ret = _media_svc_get_storage_type(db_handle, storage_id, &storage_type);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_get_storage_type_by_path failed : %d", ret);
- ret = _media_svc_delete_storage(db_handle, storage_id, storage_name, uid);
+ ret = _media_svc_delete_storage(storage_id, storage_name, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "remove storage failed : %d", ret);
- ret = _media_svc_delete_folder_by_storage_id(db_handle, storage_id, storage_type, uid);
+ ret = _media_svc_delete_folder_by_storage_id(storage_id, storage_type, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("fail to _media_svc_delete_folder_by_storage_id. error : [%d]", ret);
}
if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) || (storage_type == MEDIA_SVC_STORAGE_CLOUD)) {
- ret = _media_svc_drop_media_table(db_handle, storage_id, uid);
+ ret = _media_svc_drop_media_table(storage_id, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "drop table failed : %d", ret);
ret = _media_svc_update_media_view(db_handle, uid);
return ret;
}
-int media_svc_insert_folder_begin(MediaSvcHandle *handle, int data_cnt)
+int media_svc_insert_folder_begin(int data_cnt)
{
- sqlite3 * db_handle = (sqlite3 *)handle;
-
media_svc_debug("Transaction data count : [%d]", data_cnt);
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
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;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_insert_folder_end(MediaSvcHandle *handle, uid_t uid)
+int media_svc_insert_folder_end(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 * db_handle = (sqlite3 *)handle;
media_svc_debug_fenter();
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
if (g_media_svc_insert_folder_cur_data_cnt > 0) {
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
}
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(db_handle, MEDIA_SVC_QUERY_INSERT_FOLDER, uid);
+ 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;
return ret;
}
-int media_svc_delete_invalid_folder(MediaSvcHandle *handle, const char *storage_id, uid_t uid)
+int media_svc_delete_invalid_folder(const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- sqlite3 * db_handle = (sqlite3 *)handle;
-
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- ret = _media_svc_delete_invalid_folder(db_handle, storage_id, uid);
+ ret = _media_svc_delete_invalid_folder(storage_id, uid);
return ret;
}
if (g_insert_with_noti)
_media_svc_insert_item_to_noti_list(&content_info, g_media_svc_insert_item_cur_data_cnt);
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_INSERT_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_ITEM, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
media_svc_debug("_media_svc_list_query_do over");
ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid);
}
- ret = _media_svc_insert_item_pass2(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
+ ret = _media_svc_insert_item_pass2(storage_id, &content_info, is_burst, TRUE, uid);
_media_svc_destroy_content_info(&content_info);
SAFE_FREE(db_data->path);
}
if (idx > 0)
- ret = _media_svc_list_query_do(db_handle, MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_ITEM, uid);
g_array_free(db_data_array, FALSE);
db_data_array = NULL;
{
int ret = MS_MEDIA_ERR_NONE;
- ret = _media_svc_list_query_do(NULL, MEDIA_SVC_QUERY_UPDATE_COMMON, uid);
+ ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_COMMON, uid);
return ret;
}
#define SQLITE3_FINALIZE(x) if (x != NULL) {sqlite3_finalize(x);}
#define SQLITE3_SAFE_FREE(x) {if(x != NULL) {sqlite3_free(x);x = NULL;}}
-int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid);
+int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e list, uid_t uid);
int _media_svc_upgrade_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid);
int _media_svc_init_table_query(const char *event_table_name);
void _media_svc_destroy_table_query();
-int _media_svc_create_media_table_with_id(sqlite3 *db_handle, const char *table_id, uid_t uid);
-int _media_svc_drop_media_table(sqlite3 *handle, const char *storage_id, uid_t uid);
+int _media_svc_create_media_table_with_id(const char *table_id, uid_t uid);
+int _media_svc_drop_media_table(const char *storage_id, uid_t uid);
int _media_svc_update_media_view(sqlite3 *db_handle, uid_t uid);
-int _media_svc_sql_query(sqlite3 *db_handle, const char *sql_str, 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_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(sqlite3 *handle, uid_t uid);
-int _media_svc_sql_end_trans(sqlite3 *handle, uid_t uid);
-int _media_svc_sql_rollback_trans(sqlite3 *handle, uid_t uid);
-int _media_svc_sql_query_list(sqlite3 *handle, GList **query_list, uid_t uid);
+int _media_svc_sql_begin_trans(uid_t uid);
+int _media_svc_sql_end_trans(uid_t uid);
+int _media_svc_sql_rollback_trans(uid_t uid);
+int _media_svc_sql_query_list(GList **query_list, uid_t uid);
void _media_svc_sql_query_add(GList **query_list, char **query);
void _media_svc_sql_query_release(GList **query_list);
int _media_svc_check_db_upgrade(sqlite3 *db_handle, bool *need_full_scan, int user_version, uid_t uid);
#include "media-svc-types.h"
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 _media_svc_update_folder_modified_time_by_folder_uuid(sqlite3 *handle, const char *folder_uuid, const char *folder_path, bool stack_query, uid_t uid);
+int _media_svc_update_folder_modified_time_by_folder_uuid(const char *folder_uuid, const char *folder_path, bool stack_query, uid_t uid);
int _media_svc_get_and_append_folder(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, uid_t uid);
int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, uid_t uid);
-int _media_svc_update_folder_table(sqlite3 *handle, const char *storage_id, uid_t uid);
+int _media_svc_update_folder_table(const char *storage_id, uid_t uid);
int _media_svc_get_all_folders(sqlite3 *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int **item_num_list, int *count);
int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, bool stack_query, uid_t uid);
int _media_svc_get_folder_info_by_foldername(sqlite3 *handle, const char *storage_id, const char *folder_name, char *folder_id, time_t *modified_time);
-int _media_svc_delete_invalid_folder(sqlite3 *handle, const char *storage_id, uid_t uid);
+int _media_svc_delete_invalid_folder(const char *storage_id, uid_t 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);
-int _media_svc_delete_folder_by_storage_id(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
+int _media_svc_delete_folder_by_storage_id(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
GList ** _media_svc_get_folder_list_ptr(void);
int _media_svc_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid, int *del_count);
int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count);
int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count);
int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid);
-int _media_svc_update_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, uid_t uid);
+int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid);
int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *storage_id, 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_get_burst_id(sqlite3 *handle, const char *storage_id, int *id);
-int _media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, bool stack_query, uid_t uid);
-int _media_svc_truncate_table(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
+int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid);
+int _media_svc_truncate_table(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid);
-int _media_svc_update_storage_item_validity(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid);
+int _media_svc_update_storage_item_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, 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(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, uid_t uid);
-int _media_svc_update_item_validity(sqlite3 *handle, const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid);
-int _media_svc_update_item_by_path(sqlite3 *handle, const char *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid);
-int _media_svc_list_query_do(sqlite3 *handle, media_svc_query_type_e query_type, uid_t uid);
-int _media_svc_update_thumbnail_path(sqlite3 *handle, const char *storage_id, const char *path, const char *thumb_path, 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 *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid);
+int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid);
+int _media_svc_update_thumbnail_path(const char *storage_id, const char *path, const char *thumb_path, uid_t uid);
int _media_svc_get_noti_info(sqlite3 *handle, const char *storage_id, const char *path, int update_item, media_svc_noti_item **item);
int _media_svc_count_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, int *count);
int _media_svc_get_thumbnail_count(sqlite3 *handle, const char *storage_id, const char *thumb_path, int *count);
char *_media_svc_get_thumb_default_path(uid_t uid);
int _media_svc_get_fileinfo_by_path(sqlite3 *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size);
-int _media_svc_update_meta_with_data(sqlite3 *handle, media_svc_content_info_s *content_info);
+int _media_svc_update_meta_with_data(media_svc_content_info_s *content_info);
int _media_svc_insert_item_pass1(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid);
-int _media_svc_insert_item_pass2(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid);
+int _media_svc_insert_item_pass2(const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid);
int _media_svc_append_query_list(const char *query, uid_t uid);
int _media_svc_init_storage(sqlite3 *handle, uid_t uid);
int _media_svc_get_mmc_info(MediaSvcHandle *handle, char **storage_name, char **storage_path, int *validity, bool *info_exist);
int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, char **storage_path, int *validity);
-int _media_svc_append_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, const char *storage_path, const char *storage_account, media_svc_storage_type_e storage_type, uid_t uid);
+int _media_svc_append_storage(const char *storage_id, const char *storage_name, const char *storage_path, const char *storage_account, media_svc_storage_type_e storage_type, uid_t uid);
int _media_svc_update_storage_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int _media_svc_delete_storage(sqlite3 *handle, const char *storage_id, const char *storage_name, uid_t uid);
-int _media_svc_update_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid);
+int _media_svc_delete_storage(const char *storage_id, const char *storage_name, uid_t uid);
+int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid);
int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage_id);
int _media_svc_get_storage_type(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e *storage_type);
int _media_svc_get_storage_path(sqlite3 *handle, const char *storage_id, char **storage_path);
int _media_svc_get_storage_scan_status(sqlite3 *handle, const char*storage_id, media_svc_scan_status_type_e *scan_status);
-int _media_svc_set_storage_scan_status(sqlite3 *handle, const char*storage_id, media_svc_scan_status_type_e scan_status, uid_t uid);
+int _media_svc_set_storage_scan_status(const char*storage_id, media_svc_scan_status_type_e scan_status, uid_t uid);
int _media_svc_get_all_storage(sqlite3 *handle, char ***storage_list, char ***storage_id_list, int **scan_status_list, int *count);
int idx = 0;
char *file_list[10];
- ret = media_svc_insert_item_begin(g_db_handle, 100, TRUE, getpid());
+ ret = media_svc_insert_item_begin(100, TRUE, getpid());
/*ret = media_svc_insert_item_begin(g_db_handle, 100); */
for (idx = 0; idx < 10; idx++) {
char filepath[255] = {0, };
}
}
- ret = media_svc_insert_item_end(g_db_handle);
+ ret = media_svc_insert_item_end(tzplatform_getuid(TZ_USER_NAME));
SAFE_FREE(user_str);
return FALSE;
}
#if 1
- ret = media_svc_create_table(db_handle);
+ ret = media_svc_create_table(tzplatform_getuid(TZ_USER_NAME));
if (ret < 0) {
msg_print(__LINE__, "table already exists");
} else {