pub fn export_to_csv(
conn: &Connection,
query: &str,
filename: &str,
) -> Result<()>Expand description
Exports the results of a SQL query to a CSV file.
This function executes a given SELECT query and writes the entire result set to a
specified CSV file. It includes comprehensive validation of inputs, progress updates
for large exports, and robust error handling during file writing.
§Arguments
conn- A reference to the activerusqlite::Connection.query- TheSELECTSQL query whose results will be exported.filename- The path to the output CSV file. The file will be overwritten if it exists.
§Returns
A Result which is Ok(()) on successful export, or an Err if the query is invalid,
the file cannot be written, or other errors occur during the process.