Skip to main content

execute_statements

Function execute_statements 

Source
pub fn execute_statements(
    conn: &Connection,
    statements: &[SqlStatement],
) -> Result<u64, SqliteError>
Expand description

Execute trusted statements inside a caller-owned active transaction.

The caller owns writer admission, commit, rollback, and connection settlement. This function starts no transaction or savepoint, installs no hooks, retries nothing, and does not account committed events. The returned affected-row sum is execution evidence, not a commit receipt; zero affected rows is successful.

Explicit transaction-control heads are rejected across the list before preparation. Each element must contain only one SQL statement. Other prepare failures may be deferred until execution to allow earlier schema changes, so an error can follow earlier successful writes. Missing raw parameters bind as NULL; excess parameters fail binding before that element steps.

This is not a SQL sandbox: PRAGMAs, UDFs, triggers, and virtual tables may have connection or external effects, and SQLite errors can end the transaction. The owner must handle rollback and verify settlement on error.

ยงErrors

Returns SqliteError::InvalidData for autocommit connections (even with an empty list) or explicit transaction control. Native prepare, bind, and step failures are preserved as SqliteError::Rusqlite.