pub async fn acquire_reader_with_attached(
main_db: &SqliteDatabase,
specs: Vec<AttachedSpec>,
) -> Result<AttachedReadConnection>Expand description
Acquire a read connection with attached database(s)
This function:
- Acquires a read connection from the main database’s read pool
- For each attached spec:
- Validates the attached mode (read-only connections cannot attach read-write)
- Executes ATTACH DATABASE statement
- Returns an
AttachedReadConnectionguard that auto-detaches on drop
§Arguments
main_db- The main database to acquire a connection fromspecs- Specifications for databases to attach
§Errors
Returns an error if:
- The main database is closed
- Cannot acquire a read connection
- Attempting to attach read-write to a read connection
- ATTACH DATABASE fails