Skip to content

Commit e34100e

Browse files
committed
Add a way to obtain current database
1 parent 55b8e6e commit e34100e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/PostgresWireServer/QueryConnection.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public final class QueryClientConnection<PreparedStatementType: PreparedStatemen
1111
case closed
1212
}
1313

14+
public private(set) var database: String? = nil
1415
public private(set) var username: String? = nil
1516
public private(set) var password: String? = nil
1617
public private(set) var majorVersion: UInt16? = nil
@@ -662,6 +663,7 @@ public final class QueryClientConnection<PreparedStatementType: PreparedStatemen
662663
// Read parameters
663664
if let p = try s.readParameters(length: len - UInt32(8)) {
664665
s.username = p["user"]
666+
s.database = p["database"]
665667

666668
// Send authentication request
667669
let buf = Data(bytes: [UInt8(Character("R").codePoint), 0, 0, 0, 8, 0, 0, 0, 3])

0 commit comments

Comments
 (0)