@@ -14,9 +14,9 @@ use tracing::error;
1414
1515/// SQLite database with connection pooling for concurrent reads and optional exclusive writes.
1616///
17- /// The database is opened in read-write mode but can be used for read-only operations
18- /// by calling `read_pool()`. Write operations are available by calling `acquire_writer()`
19- /// which lazily initializes WAL mode on first use.
17+ /// Once the database is opened it can be used for read-only operations by calling `read_pool()`.
18+ /// Write operations are available by calling `acquire_writer()` which lazily initializes WAL mode
19+ /// on first use.
2020///
2121/// # Example
2222///
@@ -67,7 +67,7 @@ impl SqliteDatabase {
6767 /// If the database is already connected, returns the existing connection.
6868 /// Multiple calls with the same path will return the same database instance.
6969 ///
70- /// The database is created if it doesn't exist. WAL mode is optionally enabled when
70+ /// The database is created if it doesn't exist. WAL mode is enabled when
7171 /// `acquire_writer()` is first called.
7272 ///
7373 /// # Arguments
@@ -132,7 +132,8 @@ impl SqliteDatabase {
132132 // Why do we need to manually create the database file? We could just let the connection
133133 // create it if it doesn't exist, using `create_if_missing(true)`, right? Not if we called
134134 // connect and then our very first query was a read-only query, like `PRAGMA user_version;`,
135- // for example. That would fail because the read pool cannot create the file
135+ // for example. That would fail because the read pool connections are read-only and cannot
136+ // create the file
136137 if !db_exists && !is_memory_database ( & path) {
137138 let create_options = SqliteConnectOptions :: new ( )
138139 . filename ( & path)
@@ -175,7 +176,7 @@ impl SqliteDatabase {
175176 . await
176177 }
177178
178- /// Get a reference to the connection pool for executing SELECT queries
179+ /// Get a reference to the connection pool for executing read queries
179180 ///
180181 /// Use this for concurrent read operations. Multiple readers can access
181182 /// the pool simultaneously.
@@ -367,6 +368,7 @@ mod tests {
367368 . fetch_one ( db. read_pool ( ) . unwrap ( ) )
368369 . await
369370 . unwrap ( ) ;
371+
370372 assert_eq ! ( count, 12 ) ;
371373 } ) ) ;
372374 }
@@ -673,6 +675,7 @@ mod tests {
673675 . fetch_all ( db_clone. read_pool ( ) . unwrap ( ) )
674676 . await
675677 . unwrap ( ) ;
678+
676679 assert ! ( rows. len( ) > 0 ) ;
677680 } ) ) ;
678681 }
@@ -700,6 +703,7 @@ mod tests {
700703 . fetch_one ( db. read_pool ( ) . unwrap ( ) )
701704 . await
702705 . unwrap ( ) ;
706+
703707 assert_eq ! ( count. 0 , 2 ) ;
704708
705709 db. remove ( ) . await . unwrap ( ) ;
0 commit comments