mirror of https://github.com/jackc/pgx.git
handle this not like an idiot
parent
8d116336c3
commit
edc8216aa2
|
@ -191,10 +191,6 @@ func (r *msgReader) readBytes(count int32) []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
if count < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
b := make([]byte, int(count))
|
||||
|
||||
_, err := io.ReadFull(r.reader, b)
|
||||
|
|
|
@ -822,12 +822,10 @@ func TestReadingNullByteArray(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func TestReadingNullByteArrays(t *testing.T) {
|
||||
conn := mustConnect(t, *defaultConnConfig)
|
||||
defer closeConn(t, conn)
|
||||
|
||||
|
||||
rows, err := conn.Query("select null::text union all select null::text")
|
||||
if err != nil {
|
||||
t.Fatalf("conn.Query failed: ", err)
|
||||
|
|
|
@ -113,6 +113,10 @@ func (r *ValueReader) ReadBytes(count int32) []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
if count == -1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
r.valueBytesRemaining -= count
|
||||
if r.valueBytesRemaining < 0 {
|
||||
r.Fatal(errors.New("read past end of value"))
|
||||
|
|
Loading…
Reference in New Issue