summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-11-19 10:22:04 +0900
committerMinje Ahn <minje.ahn@samsung.com>2015-11-19 10:22:04 +0900
commit8fa4dc9b83f6af886bd29bf5fc2d933336e920ee (patch)
treeef0d012521f389b5054e3664187876b5be114cb2
parent2135da3c903be949c0a8b36ecd09344d879ae3f9 (diff)
downloadlibmedia-service-8fa4dc9b83f6af886bd29bf5fc2d933336e920ee.tar.gz
libmedia-service-8fa4dc9b83f6af886bd29bf5fc2d933336e920ee.tar.bz2
libmedia-service-8fa4dc9b83f6af886bd29bf5fc2d933336e920ee.zip
Remove unused parameter
Change-Id: Iaed6480678b7134e60e52c9b8d02af4930b4e627 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xinclude/media-svc.h32
-rwxr-xr-xplugin/media-content-plugin.c98
-rwxr-xr-xsrc/common/media-svc-album.c2
-rwxr-xr-xsrc/common/media-svc-db-utils.c76
-rwxr-xr-xsrc/common/media-svc-media-folder.c32
-rwxr-xr-xsrc/common/media-svc-media.c72
-rwxr-xr-xsrc/common/media-svc-storage.c24
-rwxr-xr-xsrc/common/media-svc.c210
-rwxr-xr-xsrc/include/common/media-svc-db-utils.h16
-rwxr-xr-xsrc/include/common/media-svc-media-folder.h8
-rwxr-xr-xsrc/include/common/media-svc-media.h22
-rwxr-xr-xsrc/include/common/media-svc-storage.h8
-rwxr-xr-xtest/media-service-test.c4
-rwxr-xr-xtest/plugin/media_svc_plugin_test.c2
14 files changed, 246 insertions, 360 deletions
diff --git a/include/media-svc.h b/include/media-svc.h
index 3452c27..9bf6e60 100755
--- a/include/media-svc.h
+++ b/include/media-svc.h
@@ -36,22 +36,22 @@ extern "C" {
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);
@@ -64,11 +64,11 @@ int media_svc_check_db_upgrade(MediaSvcHandle *handle, bool *need_full_scan, int
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);
@@ -83,16 +83,16 @@ int media_svc_set_storage_validity(MediaSvcHandle *handle, const char *storage_i
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);
diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c
index b9912b9..435638c 100755
--- a/plugin/media-content-plugin.c
+++ b/plugin/media-content-plugin.c
@@ -160,12 +160,7 @@ int insert_item_begin(void *handle, int item_cnt, int with_noti, int from_pid, c
{
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;
@@ -178,12 +173,7 @@ int insert_item_end(void *handle, uid_t uid, char **err_msg)
{
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;
@@ -280,17 +270,12 @@ int set_all_storage_items_validity(void *handle, const char *storage_id, int sto
{
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;
@@ -326,12 +311,7 @@ int set_item_validity_begin(void *handle, int item_cnt, char **err_msg)
{
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;
@@ -344,12 +324,7 @@ int set_item_validity_end(void *handle, uid_t uid, char **err_msg)
{
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;
@@ -362,17 +337,12 @@ int set_item_validity(void *handle, const char *storage_id, const char *file_pat
{
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);
@@ -415,17 +385,12 @@ int delete_all_items_in_storage(void *handle, const char *storage_id, int storag
{
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;
@@ -558,7 +523,7 @@ int check_db(void *handle, bool *need_full_scan, uid_t uid, char **err_msg)
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;
@@ -639,11 +604,6 @@ int get_uuid(void * handle, char **uuid, char **err_msg)
{
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);
@@ -823,12 +783,7 @@ int set_storage_scan_status(void *handle, const char *storage_id, int status, ui
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;
@@ -864,12 +819,7 @@ int update_item_begin(void *handle, int item_cnt, char **err_msg)
{
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;
@@ -882,12 +832,7 @@ int update_item_end(void *handle, uid_t uid, char **err_msg)
{
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;
@@ -974,12 +919,7 @@ int insert_folder_begin(void * handle, int item_cnt, char **err_msg)
{
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;
@@ -992,12 +932,7 @@ int insert_folder_end(void *handle, uid_t uid, char **err_msg)
{
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;
@@ -1038,12 +973,7 @@ int delete_invalid_folder(void * handle, const char *storage_id, uid_t uid, char
{
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;
diff --git a/src/common/media-svc-album.c b/src/common/media-svc-album.c
index ad53a03..65a8c35 100755
--- a/src/common/media-svc-album.c
+++ b/src/common/media-svc-album.c
@@ -100,7 +100,7 @@ int _media_svc_append_album(sqlite3 *handle, const char *album, const char *arti
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);
diff --git a/src/common/media-svc-db-utils.c b/src/common/media-svc-db-utils.c
index 2880f36..5856902 100755
--- a/src/common/media-svc-db-utils.c
+++ b/src/common/media-svc-db-utils.c
@@ -165,12 +165,12 @@ static int __media_svc_rebuild_view_query(sqlite3 *db_handle, uid_t uid)
/*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);
@@ -216,7 +216,7 @@ static int __media_svc_rebuild_view_query(sqlite3 *db_handle, uid_t uid)
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);
@@ -262,14 +262,14 @@ static int __media_svc_rebuild_view_query(sqlite3 *db_handle, uid_t uid)
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;
@@ -374,27 +374,27 @@ int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, medi
/*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);
}
@@ -404,7 +404,7 @@ int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, medi
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);
@@ -450,7 +450,7 @@ int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, medi
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);
@@ -493,7 +493,7 @@ int _media_svc_make_table_query(sqlite3 *db_handle, const char *table_name, medi
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);
@@ -535,14 +535,14 @@ int _media_svc_upgrade_table_query(sqlite3 *db_handle, const char *table_name, m
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);
}
}
@@ -1026,7 +1026,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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);
@@ -1039,13 +1039,13 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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;
@@ -1059,7 +1059,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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);
@@ -1072,7 +1072,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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);
@@ -1136,7 +1136,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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");
@@ -1146,7 +1146,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
goto ERROR;
}
- ret = _media_svc_sql_query(db_handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
SQLITE3_SAFE_FREE(sql);
}
@@ -1159,7 +1159,7 @@ static int __media_svc_db_upgrade(sqlite3 *db_handle, int cur_version, uid_t uid
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();
@@ -1172,7 +1172,7 @@ ERROR:
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;
@@ -1262,7 +1262,7 @@ 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(sqlite3 *handle, uid_t uid)
+int _media_svc_sql_begin_trans(uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
@@ -1273,7 +1273,7 @@ int _media_svc_sql_begin_trans(sqlite3 *handle, uid_t uid)
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;
@@ -1284,14 +1284,14 @@ int _media_svc_sql_end_trans(sqlite3 *handle, uid_t uid)
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;
@@ -1396,7 +1396,7 @@ int _media_db_check_corrupt(sqlite3 *db_handle)
}
-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;
@@ -1406,38 +1406,38 @@ int _media_svc_create_media_table_with_id(sqlite3 *db_handle, const char *table_
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;
@@ -1453,13 +1453,13 @@ 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;
@@ -1524,7 +1524,7 @@ int _media_svc_update_media_view(sqlite3 *db_handle, uid_t uid)
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;
diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c
index fd82b5f..e979606 100755
--- a/src/common/media-svc-media-folder.c
+++ b/src/common/media-svc-media-folder.c
@@ -152,7 +152,7 @@ int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_
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");
@@ -162,7 +162,7 @@ int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_
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;
@@ -182,7 +182,7 @@ static int __media_svc_append_folder(sqlite3 *handle, const char *storage_id, me
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);
@@ -194,7 +194,7 @@ static int __media_svc_append_folder(sqlite3 *handle, const char *storage_id, me
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;
@@ -204,7 +204,7 @@ int _media_svc_update_folder_modified_time_by_folder_uuid(sqlite3 *handle, const
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);
@@ -270,7 +270,7 @@ static int __media_svc_get_and_append_parent_folder(sqlite3 *handle, const char
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");
}
@@ -321,7 +321,7 @@ int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, const char *sto
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;
@@ -329,7 +329,7 @@ int _media_svc_update_folder_table(sqlite3 *handle, const char *storage_id, uid_
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;
@@ -543,7 +543,7 @@ int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const ch
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);
@@ -551,7 +551,7 @@ int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const ch
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);
@@ -563,13 +563,13 @@ int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const ch
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);
@@ -594,20 +594,20 @@ int _media_svc_set_folder_validity(sqlite3 *handle, const char *storage_id, cons
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);
@@ -642,7 +642,7 @@ int _media_svc_delete_invalid_folder_by_path(sqlite3 *handle, const char *storag
/*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);
diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c
index da79760..8a2eaf5 100755
--- a/src/common/media-svc-media.c
+++ b/src/common/media-svc-media.c
@@ -363,7 +363,7 @@ int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, me
}
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");
@@ -377,7 +377,7 @@ int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, me
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;
@@ -443,7 +443,7 @@ int _media_svc_update_meta_with_data(sqlite3 *handle, media_svc_content_info_s *
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;
@@ -514,7 +514,7 @@ int _media_svc_update_item_with_data(sqlite3 *handle, const char *storage_id, me
content_info->path
);
- ret = _media_svc_sql_query(handle, sql, uid);
+ ret = _media_svc_sql_query(sql, uid);
sqlite3_free(sql);
return ret;
@@ -565,13 +565,13 @@ int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, c
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");
@@ -585,13 +585,13 @@ int _media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, cons
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;
@@ -628,7 +628,7 @@ int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, med
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);
@@ -691,7 +691,7 @@ int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_
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);
@@ -718,14 +718,14 @@ int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_
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);
@@ -734,25 +734,25 @@ int _media_svc_update_item_validity(sqlite3 *handle, const char *storage_id, con
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;
@@ -784,26 +784,26 @@ int _media_svc_update_folder_item_validity(sqlite3 *handle, const char *storage_
/*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, */
@@ -827,7 +827,7 @@ int _media_svc_update_item_by_path(sqlite3 *handle, const char *storage_id, cons
}
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);
@@ -836,38 +836,38 @@ int _media_svc_update_item_by_path(sqlite3 *handle, const char *storage_id, cons
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;
}
@@ -883,7 +883,7 @@ int _media_svc_append_query_list(const char *query, uid_t uid)
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;
}
@@ -1104,7 +1104,7 @@ int _media_svc_insert_item_pass1(sqlite3 *handle, const char *storage_id, media_
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");
@@ -1118,7 +1118,7 @@ int _media_svc_insert_item_pass1(sqlite3 *handle, const char *storage_id, media_
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;
@@ -1199,7 +1199,7 @@ int _media_svc_insert_item_pass2(sqlite3 *handle, const char *storage_id, media_
);
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) {
diff --git a/src/common/media-svc-storage.c b/src/common/media-svc-storage.c
index 240d9b3..102aaa0 100755
--- a/src/common/media-svc-storage.c
+++ b/src/common/media-svc-storage.c
@@ -46,7 +46,7 @@ int _media_svc_init_storage(sqlite3 *handle, uid_t uid)
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);
@@ -113,13 +113,13 @@ int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, const char
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;
@@ -138,26 +138,26 @@ int _media_svc_update_storage_path(sqlite3 *handle, const char *storage_id, cons
/*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;
@@ -167,13 +167,13 @@ int _media_svc_delete_storage(sqlite3 *handle, const char *storage_id, const cha
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;
@@ -183,7 +183,7 @@ int _media_svc_update_storage_validity(sqlite3 *handle, const char *storage_id,
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;
@@ -331,7 +331,7 @@ int _media_svc_get_storage_scan_status(sqlite3 *handle, const char *storage_id,
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;
@@ -341,7 +341,7 @@ int _media_svc_set_storage_scan_status(sqlite3 *handle, const char *storage_id,
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;
diff --git a/src/common/media-svc.c b/src/common/media-svc.c
index df2dba1..5861df2 100755
--- a/src/common/media-svc.c
+++ b/src/common/media-svc.c
@@ -116,16 +116,13 @@ int media_svc_get_user_version(MediaSvcHandle *handle, int *user_version)
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.");
@@ -133,63 +130,63 @@ int media_svc_create_table(MediaSvcHandle *handle, uid_t uid)
}
/*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;
@@ -205,20 +202,20 @@ int media_svc_create_table(MediaSvcHandle *handle, uid_t uid)
#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;
@@ -287,13 +284,10 @@ int media_svc_check_item_exist_by_path(MediaSvcHandle *handle, const char *stora
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;
@@ -312,18 +306,15 @@ int media_svc_insert_item_begin(MediaSvcHandle *handle, int data_cnt, int with_n
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);
@@ -402,7 +393,7 @@ int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, m
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) {
@@ -563,9 +554,9 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv
/*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);
@@ -583,27 +574,27 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv
/*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);
@@ -613,21 +604,21 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv
/*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;
@@ -649,13 +640,10 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv
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;
@@ -664,18 +652,15 @@ int media_svc_set_item_validity_begin(MediaSvcHandle *handle, int 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;
@@ -684,12 +669,10 @@ int media_svc_set_item_validity_end(MediaSvcHandle *handle, uid_t uid)
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");
@@ -697,21 +680,21 @@ int media_svc_set_item_validity(MediaSvcHandle *handle, const char *storage_id,
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;
@@ -770,7 +753,7 @@ int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id
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);
@@ -783,7 +766,7 @@ int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id
_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;
@@ -818,18 +801,16 @@ int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id
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) {
@@ -876,15 +857,12 @@ int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char
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)
@@ -896,7 +874,7 @@ int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *stor
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);
}
@@ -938,7 +916,7 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media
}
}
- 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;
@@ -994,7 +972,7 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media
#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");
@@ -1020,7 +998,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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 */
@@ -1031,12 +1009,11 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
@@ -1055,7 +1032,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
@@ -1099,7 +1076,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
@@ -1117,7 +1094,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
@@ -1127,7 +1104,7 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
}
@@ -1154,14 +1131,13 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
}
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;
}
@@ -1180,10 +1156,10 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
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;
}
@@ -1203,7 +1179,7 @@ int media_svc_request_update_db(const char *db_query, uid_t uid)
{
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)
@@ -1294,20 +1270,17 @@ int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id,
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;
@@ -1316,18 +1289,15 @@ int media_svc_update_item_begin(MediaSvcHandle *handle, int 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;
@@ -1344,8 +1314,6 @@ int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, in
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");
@@ -1371,22 +1339,22 @@ int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, in
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;
@@ -1402,12 +1370,12 @@ int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, in
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");
@@ -1428,7 +1396,7 @@ int media_svc_set_storage_validity(MediaSvcHandle *handle, const char *storage_i
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);
@@ -1476,14 +1444,11 @@ int media_svc_get_storage_scan_status(MediaSvcHandle *handle, const char *storag
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;
}
@@ -1884,11 +1849,11 @@ int media_svc_insert_storage(MediaSvcHandle *handle, const char *storage_id, con
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);
@@ -1910,16 +1875,16 @@ int media_svc_delete_storage(MediaSvcHandle *handle, const char *storage_id, con
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);
@@ -1929,13 +1894,10 @@ int media_svc_delete_storage(MediaSvcHandle *handle, const char *storage_id, con
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;
@@ -1944,18 +1906,15 @@ int media_svc_insert_folder_begin(MediaSvcHandle *handle, int 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;
@@ -1991,7 +1950,7 @@ int media_svc_insert_folder(MediaSvcHandle *handle, const char *storage_id, medi
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;
@@ -2004,14 +1963,11 @@ int media_svc_insert_folder(MediaSvcHandle *handle, const char *storage_id, medi
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;
}
@@ -2085,7 +2041,7 @@ int media_svc_insert_item_pass1(MediaSvcHandle *handle, const char *storage_id,
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");
@@ -2199,7 +2155,7 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id,
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);
@@ -2208,7 +2164,7 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id,
}
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;
@@ -2308,7 +2264,7 @@ int media_svc_send_query(uid_t uid)
{
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;
}
diff --git a/src/include/common/media-svc-db-utils.h b/src/include/common/media-svc-db-utils.h
index 6e75602..9d2d3ef 100755
--- a/src/include/common/media-svc-db-utils.h
+++ b/src/include/common/media-svc-db-utils.h
@@ -29,21 +29,21 @@
#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);
diff --git a/src/include/common/media-svc-media-folder.h b/src/include/common/media-svc-media-folder.h
index 8290431..17c5899 100755
--- a/src/include/common/media-svc-media-folder.h
+++ b/src/include/common/media-svc-media-folder.h
@@ -27,16 +27,16 @@
#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);
diff --git a/src/include/common/media-svc-media.h b/src/include/common/media-svc-media.h
index 132fd99..2db1fff 100755
--- a/src/include/common/media-svc-media.h
+++ b/src/include/common/media-svc-media.h
@@ -30,30 +30,30 @@
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);
diff --git a/src/include/common/media-svc-storage.h b/src/include/common/media-svc-storage.h
index 13ec6fb..5acb354 100755
--- a/src/include/common/media-svc-storage.h
+++ b/src/include/common/media-svc-storage.h
@@ -27,15 +27,15 @@
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);
diff --git a/test/media-service-test.c b/test/media-service-test.c
index a50c592..f3cd711 100755
--- a/test/media-service-test.c
+++ b/test/media-service-test.c
@@ -98,7 +98,7 @@ gboolean _send_noti_batch_operations(gpointer data)
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, };
@@ -113,7 +113,7 @@ gboolean _send_noti_batch_operations(gpointer data)
}
}
- 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;
diff --git a/test/plugin/media_svc_plugin_test.c b/test/plugin/media_svc_plugin_test.c
index 9ac5888..8919029 100755
--- a/test/plugin/media_svc_plugin_test.c
+++ b/test/plugin/media_svc_plugin_test.c
@@ -107,7 +107,7 @@ int main()
}
#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 {