mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Improvements based on PR feedback
This commit is contained in:
1 parent
7d0c8c6657
commit
dc40da1ef2
1 file changed
+21
-5
@@ -320,16 +320,32 @@ extension DatabaseWriter {
|
||||
try writeWithoutTransaction { try $0.execute(sql: "VACUUM") }
|
||||
}
|
||||
|
||||
/// Creates a new database file at the specified file with a minimum
|
||||
// VACUUM INTO was introduced in SQLite 3.27.0:
|
||||
// https://www.sqlite.org/releaselog/3_27_0.html
|
||||
#if GRDBCUSTOMSQLITE
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
/// See https://www.sqlite.org/lang_vacuum.html for more information.
|
||||
/// See https://www.sqlite.org/lang_vacuum.html#vacuuminto for more information.
|
||||
///
|
||||
/// - Parameter into: filename for new database
|
||||
public func vacuum(into: String) throws {
|
||||
/// - Parameter filePath: file path for new database
|
||||
public func vacuum(into filePath: String) throws {
|
||||
try writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [into])
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#elseif !GRDBCIPHER
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
/// See https://www.sqlite.org/lang_vacuum.html#vacuuminto for more information.
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
@available(OSX 10.16, iOS 14, tvOS 14, watchOS 7, *)
|
||||
public func vacuum(into filePath: String) throws {
|
||||
try writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - Database Observation
|
||||
|
||||
|
||||
Reference in new issue
Block a user