Skip to content

Commit 95188f9

Browse files
committed
host -> hostname
1 parent 8d2a347 commit 95188f9

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

Sources/MySQL/Connection.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import Foundation
77
/// Do not try to make a copy of a MYSQL structure.
88
/// There is no guarantee that such a copy will be usable.
99
public final class Connection {
10-
1110
public typealias CConnection = UnsafeMutablePointer<MYSQL>
1211

1312
public let cConnection: CConnection
1413
public var isClosed: Bool
1514

1615
init(
17-
host: String,
16+
hostname: String,
1817
user: String,
1918
password: String,
2019
database: String,
@@ -31,7 +30,7 @@ public final class Connection {
3130

3231
guard mysql_real_connect(
3332
cConnection,
34-
host,
33+
hostname,
3534
user,
3635
password,
3736
database,

Sources/MySQL/Database.swift

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ import Core
33

44
/// Creates `Connection`s to the MySQL database.
55
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+
616
/// Attempts to establish a connection to a MySQL database
717
/// engine running on host.
818
///
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.
1020
/// If host is the string "localhost", a connection to the local host is assumed.
1121
/// - parameter user: The user's MySQL login ID.
1222
/// - parameter password: Password for user.
@@ -22,7 +32,7 @@ public final class Database {
2232
/// used, since "utf8" does not fully implement the UTF8 standard and does
2333
/// not support Unicode.
2434
public init(
25-
host: String,
35+
hostname: String,
2636
user: String,
2737
password: String,
2838
database: String,
@@ -38,7 +48,7 @@ public final class Database {
3848
throw MySQLError(.serverInit, reason: "The server failed to initialize.")
3949
}
4050

41-
self.host = host
51+
self.hostname = hostname
4252
self.user = user
4353
self.password = password
4454
self.database = database
@@ -49,24 +59,13 @@ public final class Database {
4959
self.optionsGroupName = optionsGroupName
5060
}
5161

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-
6362
/// Creates a new connection to
6463
/// the database that can be reused between executions.
6564
///
6665
/// The connection will close automatically when deinitialized.
6766
public func makeConnection() throws -> Connection {
6867
return try Connection(
69-
host: host,
68+
hostname: hostname,
7069
user: user,
7170
password: password,
7271
database: database,

Tests/MySQLTests/Utilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extension MySQL.Database {
55
static func makeTest() -> MySQL.Database {
66
do {
77
let mysql = try MySQL.Database(
8-
host: "127.0.0.1",
8+
hostname: "127.0.0.1",
99
user: "ubuntu",
1010
password: "",
1111
database: "circle_test"

0 commit comments

Comments
 (0)