@@ -46,7 +46,7 @@ public struct SQLite {
4646 }
4747 self . db = db
4848 try Self . checkError ( " Unable to configure database " ) { sqlite3_extended_result_codes ( db, 1 ) }
49- try Self . checkError ( " Unable to configure database " ) { sqlite3_busy_timeout ( db, self . configuration. busyTimeoutSeconds ) }
49+ try Self . checkError ( " Unable to configure database " ) { sqlite3_busy_timeout ( db, self . configuration. busyTimeoutMilliseconds ) }
5050 }
5151
5252 @available ( * , deprecated, message: " use init(location:configuration) instead " )
@@ -89,10 +89,29 @@ public struct SQLite {
8989 public typealias SQLiteExecCallback = ( [ Column ] ) -> Void
9090
9191 public struct Configuration {
92- public var busyTimeoutSeconds : Int32
92+ public var busyTimeoutMilliseconds : Int32
9393
9494 public init ( ) {
95- self . busyTimeoutSeconds = 5
95+ self . busyTimeoutMilliseconds = 5000
96+ }
97+
98+ // FIXME: deprecated 12/2020, remove once clients migrated over
99+ @available ( * , deprecated, message: " use busyTimeout instead " )
100+ public var busyTimeoutSeconds : Int32 {
101+ get {
102+ self . _busyTimeoutSeconds
103+ } set {
104+ self . _busyTimeoutSeconds = newValue
105+ }
106+ }
107+
108+ // so tests dont warn
109+ internal var _busyTimeoutSeconds : Int32 {
110+ get {
111+ return Int32 ( truncatingIfNeeded: Int ( Double ( self . busyTimeoutMilliseconds) / 1000 ) )
112+ } set {
113+ self . busyTimeoutMilliseconds = newValue * 1000
114+ }
96115 }
97116 }
98117
0 commit comments