{= # # # delete_database.cfv # This is called from delete_profile as new process to delete a MySQL or MS SQL database. # include "templates.util.rbac.rbac_util"; debug_message("\n\n#### delete_database.cfv \n\n"); string session_id = volatile.session_id; string profile_name = internal.profile_name; string page_token = volatile.page_token; debug_message("#### profile_name: " . profile_name . "\n"); # Make sure the user has permission to delete the database, respectively profile bool is_delete_permission = get_is_delete_profile_permission(profile_name); if (is_delete_permission and get_is_valid_page_token(session_id, "profiles", page_token)) then ( # Access a profile subnode to be sure that the profile is in memory # because the profile file becomes deleted in the callee. string database_type = @("profiles." . profile_name . ".database.options.server.type"); # debug_message("#### database_type: " . database_type . "\n"); # Disconnect from the database if this is MSSQL if (database_type eq "odbc_mssql") then ( database_sql_query("USE MASTER", false, false); ); # debug_message("#### DROP DATABASE START \n"); database_sql_query("DROP DATABASE " . profile_name, false, false); # debug_message("#### DROP DATABASE END \n"); ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); debug_message("#### delete_database.cfv END \n\n"); =}