@@ -3,10 +3,20 @@ import Core
3
3
4
4
/// Creates `Connection`s to the MySQL database.
5
5
public final class Database {
6
+ public let hostname : String
7
+ public let user : String
8
+ public let password : String
9
+ public let database : String
10
+ public let port : UInt32
11
+ public let socket : String ?
12
+ public let flag : UInt
13
+ public let encoding : String
14
+ public let optionsGroupName : String
15
+
6
16
/// Attempts to establish a connection to a MySQL database
7
17
/// engine running on host.
8
18
///
9
- /// - parameter host : May be either a host name or an IP address.
19
+ /// - parameter hostname : May be either a host name or an IP address.
10
20
/// If host is the string "localhost", a connection to the local host is assumed.
11
21
/// - parameter user: The user's MySQL login ID.
12
22
/// - parameter password: Password for user.
@@ -22,7 +32,7 @@ public final class Database {
22
32
/// used, since "utf8" does not fully implement the UTF8 standard and does
23
33
/// not support Unicode.
24
34
public init (
25
- host : String ,
35
+ hostname : String ,
26
36
user: String ,
27
37
password: String ,
28
38
database: String ,
@@ -38,7 +48,7 @@ public final class Database {
38
48
throw MySQLError ( . serverInit, reason: " The server failed to initialize. " )
39
49
}
40
50
41
- self . host = host
51
+ self . hostname = hostname
42
52
self . user = user
43
53
self . password = password
44
54
self . database = database
@@ -49,24 +59,13 @@ public final class Database {
49
59
self . optionsGroupName = optionsGroupName
50
60
}
51
61
52
- private let host : String
53
- private let user : String
54
- private let password : String
55
- private let database : String
56
- private let port : UInt32
57
- private let socket : String ?
58
- private let flag : UInt
59
- private let encoding : String
60
- private let optionsGroupName : String
61
-
62
-
63
62
/// Creates a new connection to
64
63
/// the database that can be reused between executions.
65
64
///
66
65
/// The connection will close automatically when deinitialized.
67
66
public func makeConnection( ) throws -> Connection {
68
67
return try Connection (
69
- host : host ,
68
+ hostname : hostname ,
70
69
user: user,
71
70
password: password,
72
71
database: database,
0 commit comments