typedef int (*SEND_DIR_UPDATE_NOTI)(sqlite3 *, const char *, const char *, const char *, int, int);
typedef int (*INSERT_ITEM)(sqlite3 *, const char *, const char *, int, uid_t);
-typedef int (*SET_ALL_STORAGE_ITEMS_VALIDITY)(sqlite3 *, const char *, int, int, uid_t);
typedef int (*SET_FOLDER_ITEM_VALIDITY)(sqlite3 *, const char *, const char *, int, int, uid_t);
typedef int (*SET_ITEM_VALIDITY)(const char *, const char *, int, int, uid_t);
typedef int (*DELETE_ITEM)(sqlite3 *, const char *, const char *, uid_t);
eINSERT_END,
eINSERT_BATCH,
eINSERT_SCAN,
- eSET_ALL_VALIDITY,
eSET_VALIDITY_BEGIN,
eSET_VALIDITY_END,
eSET_VALIDITY,
"insert_item_end",
"insert_item",
"insert_item_scan",
- "set_all_storage_items_validity",
"set_item_validity_begin",
"set_item_validity_end",
"set_item_validity",
return ret;
}
+bool __ms_check_storage_type(ms_user_storage_type_e storage_type)
+{
+ if ((storage_type != MS_USER_STORAGE_INTERNAL)
+ && (storage_type != MS_USER_STORAGE_EXTERNAL)
+ && (storage_type != MS_USER_STORAGE_EXTERNAL_USB)) {
+ MS_DBG_ERR("storage type is incorrect[%d]", storage_type);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
int ms_validity_change_all_items(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity , uid_t uid)
{
- int lib_index;
int ret = MS_MEDIA_ERR_NONE;
- for (lib_index = 0; lib_index < lib_num; lib_index++) {
- ret = ((SET_ALL_STORAGE_ITEMS_VALIDITY)func_array[lib_index][eSET_ALL_VALIDITY])(handle, storage_id, storage_type, validity, uid); /*dlopen*/
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s", g_array_index(so_array, char*, lib_index));
- }
+ MS_DBG_RETVM_IF(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
+ MS_DBG_RETVM_IF(__ms_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
+
+ char *sql = sqlite3_mprintf("UPDATE '%q' SET validity=%d WHERE storage_type=%d;", storage_id, validity, storage_type);
+
+ ret = media_db_request_update_db(sql, uid);
+ MS_SQLITE3_SAFE_FREE(sql);
return ret;
}
return;
}
-