return ret;
}
-static int __mc_update_dead_server(void *handle, const char *server_name)
-{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
- char *sql_str = NULL;
-
- mc_retvm_if(handle == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
- mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "server_name is invalid");
-
- /* Update server_state to deactivated, if the server is latest.
- * Drop the table of server_name, if it is not latest.
- */
- if (__mc_db_is_latest(handle, server_name)) {
- ret = __mc_update_latest_server_info(handle, server_name, MC_SERVER_STATE_DEACTIVATE, MC_PLAYBACK_STATE_STOPPED, FALSE);
- } else {
- sql_str = sqlite3_mprintf(DB_DROP_TABLE, server_name);
- ret = mc_db_util_update_db(handle, sql_str);
- SQLITE3_SAFE_FREE(sql_str);
- }
-
- return ret;
-}
-
char *mc_db_get_db_path(uid_t uid)
{
char *db_path = NULL;
return ret;
}
+ /* Update server_state to deactivated, if the server is latest.
+ * Drop the table of server_name, if it is not latest.
+ */
if (__mc_db_is_latest(_db_handle, app_id)) {
ret = __mc_update_latest_server_info(_db_handle, app_id, MC_SERVER_STATE_DEACTIVATE, MC_PLAYBACK_STATE_STOPPED, FALSE);
} else {
int mc_db_util_remove_dead_application(uid_t uid, const char *app_id, const mc_priv_type_e priv_type)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
- char *sql_str = NULL;
- void* db_handle = NULL;
mc_retvm_if(app_id == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "app_id is NULL");
- ret = mc_db_connect(&db_handle, uid, TRUE);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "mc_db_connect error : %d", ret);
-
/* Delete application from server/client list */
- if (priv_type == MC_PRIV_TYPE_SERVER)
- sql_str = sqlite3_mprintf(DB_DELETE_FROM_SERVER_LIST, app_id);
- else
- sql_str = sqlite3_mprintf(DB_DELETE_FROM_CLIENT_LIST, app_id);
-
- ret = mc_db_util_update_db(db_handle, sql_str);
+ ret = mc_db_util_delete_from_list(uid, app_id, priv_type);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_secure_error("media_db_update_db error : %d", ret);
+ mc_secure_error("mc_db_util_delete_from_list error : %d", ret);
/* Drop server table to remove application information if it is not latest.
* Update application information if it is latest.
*/
if (priv_type == MC_PRIV_TYPE_SERVER) {
- ret = __mc_update_dead_server(db_handle, app_id);
+ ret = mc_db_util_deactivate_server_table(uid, app_id);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_secure_error("__mc_drop_server_table error : %d", ret);
+ mc_secure_error("mc_db_util_deactivate_server_table error : %d", ret);
}
- mc_db_disconnect(db_handle);
-
return ret;
}