Skip to content

Commit

Permalink
Merge pull request #95 from ViliamKopecky/master
Browse files Browse the repository at this point in the history
Fix OID decoding as UInt32
  • Loading branch information
rafiki270 authored Jul 26, 2018
2 parents a4c205a + c2bb1b5 commit 3fcc626
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ extension FixedWidthInteger {
throw PostgreSQLError.decode(self, from: data)
}
i = value.as(Int16.self, default: 0).bigEndian.cast(to: Self.self)
case .int4, .oid, .regproc:
case .int4, .regproc:
guard value.count == 4 else {
throw PostgreSQLError.decode(self, from: data)
}
i = value.as(Int32.self, default: 0).bigEndian.cast(to: Self.self)
case .oid:
guard value.count == 4 else {
throw PostgreSQLError.decode(self, from: data)
}
i = value.as(UInt32.self, default: 0).bigEndian.cast(to: Self.self)
case .int8:
guard value.count == 8 else {
throw PostgreSQLError.decode(self, from: data)
Expand Down

0 comments on commit 3fcc626

Please sign in to comment.