use crate::adapters::snowflake::_helpers::write::rows_loaded::rows_loaded;
use crate::adapters::snowflake::models::SnowflakeDestination;
use crate::http::errors::ApiError;
use crate::sql_api::main::execute_script_rows::execute_script_rows;
pub(in crate::adapters) async fn script_copy_rows(
destination: &SnowflakeDestination,
statements: &[String],
) -> Result<u64, ApiError> {
let results = execute_script_rows(&destination.sql, statements).await?;
let mut rows: u64 = 0;
for result in &results {
rows += rows_loaded(result)?;
}
Ok(rows)
}