Skip to content

Commit 0d3099f

Browse files
authored
Merge pull request #58 from mura-admin/uint32oids
Fix Int32 -> UInt32 OIDs
2 parents e4bbd47 + 59054e5 commit 0d3099f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Sources/PostgreSQL/Data/PostgreSQLColumn.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// Represents a PostgreSQL column.
22
public struct PostgreSQLColumn: Hashable, Equatable {
33
/// The table this column belongs to.
4-
public var tableOID: Int32
4+
public var tableOID: UInt32
55

66
/// The column's name.
77
public var name: String
@@ -26,7 +26,7 @@ extension Dictionary where Key == PostgreSQLColumn {
2626

2727
/// Access a `Value` from this dictionary keyed by `PostgreSQLColumn`s
2828
/// using a field (column) name and entity (table) name.
29-
public func value(forTableOID tableOID: Int32, atColumn column: String) -> Value? {
29+
public func value(forTableOID tableOID: UInt32, atColumn column: String) -> Value? {
3030
return self[PostgreSQLColumn(tableOID: tableOID, name: column)]
3131
}
3232
}

Sources/PostgreSQL/Message+Parse/PostgreSQLMessageDecoders.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ final class _PostgreSQLMessageDecoder: Decoder, SingleValueDecodingContainer {
4343
VERBOSE("_PostgreSQLMessageDecoder.decode(_: \(type))")
4444
return try data.requireReadInteger()
4545
}
46+
47+
/// See SingleValueDecodingContainer.decode
48+
func decode(_ type: UInt32.Type) throws -> UInt32 {
49+
VERBOSE("_PostgreSQLMessageDecoder.decode(_: \(type))")
50+
return try data.requireReadInteger()
51+
}
4652

4753
/// See SingleValueDecodingContainer.decode
4854
func decode(_ type: String.Type) throws -> String {
@@ -98,7 +104,6 @@ final class _PostgreSQLMessageDecoder: Decoder, SingleValueDecodingContainer {
98104
func decode(_ type: Int64.Type) throws -> Int64 { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
99105
func decode(_ type: UInt.Type) throws -> UInt { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
100106
func decode(_ type: UInt16.Type) throws -> UInt16 { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
101-
func decode(_ type: UInt32.Type) throws -> UInt32 { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
102107
func decode(_ type: UInt64.Type) throws -> UInt64 { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
103108
func decode(_ type: Float.Type) throws -> Float { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }
104109
func decode(_ type: Double.Type) throws -> Double { throw PostgreSQLError(identifier: "decoder", reason: "Unsupported decode type: \(type)", source: .capture()) }

Sources/PostgreSQL/Message/PostgreSQLRowDescription.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct PostgreSQLRowDescriptionField: Decodable {
4545
var name: String
4646

4747
/// If the field can be identified as a column of a specific table, the object ID of the table; otherwise zero.
48-
var tableObjectID: Int32
48+
var tableObjectID: UInt32
4949

5050
/// If the field can be identified as a column of a specific table, the attribute number of the column; otherwise zero.
5151
var columnAttributeNumber: Int16

0 commit comments

Comments
 (0)