Skip to main content

run_script

Function run_script 

Source
pub async fn run_script(sql: &str) -> Result<(), AppError>
Expand description

Runs an uploaded .sql file’s full contents (the SQL Import feature) - unlike run_raw, this doesn’t return or render rows, because an imported file is typically many statements, not one query to display. Uses sqlx::raw_sql rather than fetch_all, the same primitive larust_orm::migrate::run already relies on for exactly this reason: it delegates statement parsing to the backend itself, so multi-statement files, comments, and string literals containing semicolons all work correctly (splitting on ; by hand does not - a real bug this framework already hit once in the migration runner). Same deliberately- unrestricted security posture as run_raw.