@@ -35,22 +35,27 @@ public final class SQLite {
3535 self . configuration = configuration
3636
3737 var handle : OpaquePointer ?
38- try Self . checkError ( {
39- sqlite3_open_v2 (
40- location. pathString,
41- & handle,
42- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX,
43- nil
44- )
45- } ,
46- description: " Unable to open database at \( self . location) " )
38+ try Self . checkError (
39+ {
40+ sqlite3_open_v2 (
41+ location. pathString,
42+ & handle,
43+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX,
44+ nil
45+ )
46+ } ,
47+ description: " Unable to open database at \( self . location) "
48+ )
4749
4850 guard let db = handle else {
4951 throw StringError ( " Unable to open database at \( self . location) " )
5052 }
5153 self . db = db
5254 try Self . checkError ( { sqlite3_extended_result_codes ( db, 1 ) } , description: " Unable to configure database " )
53- try Self . checkError ( { sqlite3_busy_timeout ( db, self . configuration. busyTimeoutMilliseconds) } , description: " Unable to configure database busy timeout " )
55+ try Self . checkError (
56+ { sqlite3_busy_timeout ( db, self . configuration. busyTimeoutMilliseconds) } ,
57+ description: " Unable to configure database busy timeout "
58+ )
5459 if let maxPageCount = self . configuration. maxPageCount {
5560 try self . exec ( query: " PRAGMA max_page_count= \( maxPageCount) ; " )
5661 }
@@ -120,7 +125,7 @@ public final class SQLite {
120125 // so tests dont warn
121126 internal var _busyTimeoutSeconds : Int32 {
122127 get {
123- return Int32 ( truncatingIfNeeded: Int ( Double ( self . busyTimeoutMilliseconds) / 1000 ) )
128+ Int32 ( truncatingIfNeeded: Int ( Double ( self . busyTimeoutMilliseconds) / 1000 ) )
124129 } set {
125130 self . busyTimeoutMilliseconds = newValue * 1000
126131 }
@@ -184,7 +189,7 @@ public final class SQLite {
184189
185190 /// Get string at the given column index.
186191 public func string( at index: Int32 ) -> String {
187- return String ( cString: sqlite3_column_text ( self . stmt, index) )
192+ String ( cString: sqlite3_column_text ( self . stmt, index) )
188193 }
189194 }
190195
@@ -195,7 +200,7 @@ public final class SQLite {
195200
196201 /// Represents a prepared statement.
197202 public struct PreparedStatement {
198- typealias sqlite3_destructor_type = ( @convention ( c) ( UnsafeMutableRawPointer ? ) -> Void )
203+ typealias sqlite3_destructor_type = @convention ( c) ( UnsafeMutableRawPointer ? ) -> Void
199204 static let SQLITE_STATIC = unsafeBitCast ( 0 , to: sqlite3_destructor_type. self)
200205 static let SQLITE_TRANSIENT = unsafeBitCast ( - 1 , to: sqlite3_destructor_type. self)
201206
0 commit comments