File tree 2 files changed +15
-0
lines changed
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 {
252
252
@discardableResult public func run( _ statement: String , _ bindings: [ String : Binding ? ] ) throws -> Statement {
253
253
return try prepare ( statement) . run ( bindings)
254
254
}
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
+ }
255
266
256
267
// MARK: - Scalar
257
268
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ class ConnectionTests : SQLiteTestCase {
111
111
try ! db. run ( " SELECT * FROM users WHERE admin = $admin " , [ " $admin " : 0 ] )
112
112
AssertSQL ( " SELECT * FROM users WHERE admin = 0 " , 4 )
113
113
}
114
+
115
+ func test_vacuum( ) {
116
+ try ! db. vacuum ( )
117
+ }
114
118
115
119
func test_scalar_preparesRunsAndReturnsScalarValues( ) {
116
120
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