#include "media-svc-util.h"
#include "media-svc-db-utils.h"
-static __thread GList *g_media_svc_insert_folder_query_list;
-
int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_id, const char *folder_name, char *folder_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type,
- const char *folder_id, const char *folder_path, bool stack_query, uid_t uid)
+static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *folder_id, const char *folder_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *folder_name = NULL;
char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_id, folder_path, folder_name, storage_uuid, folder_storage_type, folder_modified_time, folder_name_pinyin) values (%Q, %Q, %Q, %Q, '%d', '%d', %Q); ",
MEDIA_SVC_DB_TABLE_FOLDER, folder_id, folder_path, folder_name, storage_id, storage_type, folder_modified_date, folder_name_pinyin);
- if (!stack_query) {
- if (is_direct)
- ret = _media_svc_sql_query_direct(sql, uid);
- else
- ret = _media_svc_sql_query(sql, uid);
+ if (is_direct)
+ ret = _media_svc_sql_query_direct(sql, uid);
+ else
+ ret = _media_svc_sql_query(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- } else {
- _media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql);
- }
+ SQLITE3_SAFE_FREE(sql);
SAFE_FREE(folder_name);
SAFE_FREE(folder_name_pinyin);
return MS_MEDIA_ERR_INTERNAL;
}
- ret = __media_svc_append_folder(is_direct, storage_id, storage_type, folder_uuid, dir_path, FALSE, uid);
+ ret = __media_svc_append_folder(is_direct, storage_id, storage_type, folder_uuid, dir_path, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("__media_svc_append_folder is failed");
return ret;
}
-int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, char *folder_id, bool stack_query, uid_t uid)
+int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid)
{
char *path_name = NULL;
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
+ char folder_id[MEDIA_SVC_UUID_SIZE + 1] = {0, };
path_name = strdup(path);
if (path_name == NULL) {
ret = __media_svc_get_and_append_parent_folder(handle, true, storage_id, path_name, storage_type, folder_id, uid);
} else {
sql = sqlite3_mprintf("UPDATE %q SET validity=1 WHERE storage_uuid = '%q' AND folder_path = '%q';", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, path);
- if (!stack_query) {
- ret = _media_svc_sql_query_direct(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- } else {
- _media_svc_sql_query_add(&g_media_svc_insert_folder_query_list, &sql);
- }
+ ret = _media_svc_sql_query_direct(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
}
SAFE_FREE(path_name);
return ret;
}
-GList **_media_svc_get_folder_list_ptr(void)
-{
- return &g_media_svc_insert_folder_query_list;
-}
-
int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count)
{
int ret = MS_MEDIA_ERR_NONE;