File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,17 @@ public final class Connection {
252252 @discardableResult public func run( _ statement: String , _ bindings: [ String : Binding ? ] ) throws -> Statement {
253253 return try prepare ( statement) . run ( bindings)
254254 }
255+
256+ // MARK: - VACUUM
257+
258+ /// Run a vacuum on the database
259+ ///
260+ /// - Throws: `Result.Error` if query execution fails.
261+ ///
262+ /// - Returns: The statement.
263+ @discardableResult public func vacuum( ) throws -> Statement {
264+ return try run ( " VACUUM " )
265+ }
255266
256267 // MARK: - Scalar
257268
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ class ConnectionTests : SQLiteTestCase {
111111 try ! db. run ( " SELECT * FROM users WHERE admin = $admin " , [ " $admin " : 0 ] )
112112 AssertSQL ( " SELECT * FROM users WHERE admin = 0 " , 4 )
113113 }
114+
115+ func test_vacuum( ) {
116+ try ! db. vacuum ( )
117+ }
114118
115119 func test_scalar_preparesRunsAndReturnsScalarValues( ) {
116120 XCTAssertEqual ( 0 , try ! db. scalar ( " SELECT count(*) FROM users WHERE admin = 0 " ) as? Int64 )
You can’t perform that action at this time.
0 commit comments