Adding required info for DSN/Socket
This commit is contained in:
parent
aa28a85065
commit
8b0578ef36
|
@ -32,9 +32,10 @@ open class StORMConnect {
|
|||
host: String,
|
||||
username: String = "",
|
||||
password: String = "",
|
||||
port: Int = 0) {
|
||||
port: Int = 0,
|
||||
method: StORMConnectionMethod = .network) {
|
||||
self.datasource = ds
|
||||
self.credentials = StORMDataSourceCredentials(host: host, port: port, user: username, pass: password)
|
||||
self.credentials = StORMDataSourceCredentials(host: host, port: port, user: username, pass: password, method: method)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
//
|
||||
//
|
||||
|
||||
public enum StORMConnectionMethod: String {
|
||||
case socket, network
|
||||
}
|
||||
|
||||
/// Storage for current datasource connection properties.
|
||||
public struct StORMDataSourceCredentials {
|
||||
|
||||
|
@ -21,13 +25,17 @@ public struct StORMDataSourceCredentials {
|
|||
/// Password for accessing the datasource.
|
||||
public var password: String = ""
|
||||
|
||||
/// Set the connection method - network (tcp/ip), or socket/dsn.
|
||||
public var method: StORMConnectionMethod = .network
|
||||
|
||||
public init() {}
|
||||
|
||||
/// Initializer to set properties at instantiation.
|
||||
public init(host: String, port: Int = 0, user: String = "", pass: String = "") {
|
||||
public init(host: String, port: Int = 0, user: String = "", pass: String = "", method: StORMConnectionMethod = .network) {
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.username = user
|
||||
self.password = pass
|
||||
self.method = method
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue