Add a way to obtain current database

This commit is contained in:
Tommy van der Vorst 2017-12-03 19:49:35 +01:00
parent 55b8e6e08d
commit e34100e120
1 changed files with 2 additions and 0 deletions

View File

@ -11,6 +11,7 @@ public final class QueryClientConnection<PreparedStatementType: PreparedStatemen
case closed
}
public private(set) var database: String? = nil
public private(set) var username: String? = nil
public private(set) var password: String? = nil
public private(set) var majorVersion: UInt16? = nil
@ -662,6 +663,7 @@ public final class QueryClientConnection<PreparedStatementType: PreparedStatemen
// Read parameters
if let p = try s.readParameters(length: len - UInt32(8)) {
s.username = p["user"]
s.database = p["database"]
// Send authentication request
let buf = Data(bytes: [UInt8(Character("R").codePoint), 0, 0, 0, 8, 0, 0, 0, 3])