mirror of https://github.com/jackc/pgx.git
parent
d7529600e0
commit
646136fb44
4
conn.go
4
conn.go
|
@ -406,7 +406,7 @@ func (r *Row) Scan(dest ...interface{}) (err error) {
|
||||||
return rows.Err()
|
return rows.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !rows.NextRow() {
|
if !rows.Next() {
|
||||||
if rows.Err() == nil {
|
if rows.Err() == nil {
|
||||||
return ErrNoRows
|
return ErrNoRows
|
||||||
} else {
|
} else {
|
||||||
|
@ -507,7 +507,7 @@ func (rows *Rows) Fatal(err error) {
|
||||||
rows.Close()
|
rows.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rows *Rows) NextRow() bool {
|
func (rows *Rows) Next() bool {
|
||||||
if rows.closed {
|
if rows.closed {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ func TestConnPoolQuery(t *testing.T) {
|
||||||
t.Fatalf("Unexpected connection pool stats: %v", stats)
|
t.Fatalf("Unexpected connection pool stats: %v", stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
for rows.NextRow() {
|
for rows.Next() {
|
||||||
var n int32
|
var n int32
|
||||||
rows.Scan(&n)
|
rows.Scan(&n)
|
||||||
sum += n
|
sum += n
|
||||||
|
|
24
conn_test.go
24
conn_test.go
|
@ -316,7 +316,7 @@ func TestConnQuery(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
for rows.NextRow() {
|
for rows.Next() {
|
||||||
var n int32
|
var n int32
|
||||||
rows.Scan(&n)
|
rows.Scan(&n)
|
||||||
sum += n
|
sum += n
|
||||||
|
@ -345,7 +345,7 @@ func ensureConnValid(t *testing.T, conn *pgx.Conn) {
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
for rows.NextRow() {
|
for rows.Next() {
|
||||||
var n int32
|
var n int32
|
||||||
rows.Scan(&n)
|
rows.Scan(&n)
|
||||||
sum += n
|
sum += n
|
||||||
|
@ -386,9 +386,9 @@ func TestConnQueryCloseEarly(t *testing.T) {
|
||||||
t.Fatalf("conn.Query failed: ", err)
|
t.Fatalf("conn.Query failed: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := rows.NextRow()
|
ok := rows.Next()
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("rows.NextRow terminated early")
|
t.Fatal("rows.Next terminated early")
|
||||||
}
|
}
|
||||||
|
|
||||||
var n int32
|
var n int32
|
||||||
|
@ -417,7 +417,7 @@ func TestConnQueryReadWrongTypeError(t *testing.T) {
|
||||||
|
|
||||||
rowsRead := 0
|
rowsRead := 0
|
||||||
|
|
||||||
for rows.NextRow() {
|
for rows.Next() {
|
||||||
var t time.Time
|
var t time.Time
|
||||||
rows.Scan(&t)
|
rows.Scan(&t)
|
||||||
rowsRead++
|
rowsRead++
|
||||||
|
@ -449,7 +449,7 @@ func TestConnQueryReadTooManyValues(t *testing.T) {
|
||||||
|
|
||||||
rowsRead := 0
|
rowsRead := 0
|
||||||
|
|
||||||
for rows.NextRow() {
|
for rows.Next() {
|
||||||
var n, m int32
|
var n, m int32
|
||||||
rows.Scan(&n, &m)
|
rows.Scan(&n, &m)
|
||||||
rowsRead++
|
rowsRead++
|
||||||
|
@ -477,9 +477,9 @@ func TestConnQueryUnpreparedScanner(t *testing.T) {
|
||||||
t.Fatalf("conn.Query failed: ", err)
|
t.Fatalf("conn.Query failed: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := rows.NextRow()
|
ok := rows.Next()
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("rows.NextRow terminated early")
|
t.Fatal("rows.Next terminated early")
|
||||||
}
|
}
|
||||||
|
|
||||||
var n, m pgx.NullInt64
|
var n, m pgx.NullInt64
|
||||||
|
@ -517,9 +517,9 @@ func TestConnQueryPreparedScanner(t *testing.T) {
|
||||||
t.Fatalf("conn.Query failed: ", err)
|
t.Fatalf("conn.Query failed: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := rows.NextRow()
|
ok := rows.Next()
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("rows.NextRow terminated early")
|
t.Fatal("rows.Next terminated early")
|
||||||
}
|
}
|
||||||
|
|
||||||
var n, m pgx.NullInt64
|
var n, m pgx.NullInt64
|
||||||
|
@ -557,9 +557,9 @@ func TestConnQueryUnpreparedEncoder(t *testing.T) {
|
||||||
t.Fatalf("conn.Query failed: ", err)
|
t.Fatalf("conn.Query failed: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := rows.NextRow()
|
ok := rows.Next()
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("rows.NextRow terminated early")
|
t.Fatal("rows.Next terminated early")
|
||||||
}
|
}
|
||||||
|
|
||||||
var m pgx.NullInt64
|
var m pgx.NullInt64
|
||||||
|
|
|
@ -182,7 +182,7 @@ func (r *Rows) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rows) Next(dest []driver.Value) error {
|
func (r *Rows) Next(dest []driver.Value) error {
|
||||||
more := r.rows.NextRow()
|
more := r.rows.Next()
|
||||||
if !more {
|
if !more {
|
||||||
if r.rows.Err() == nil {
|
if r.rows.Err() == nil {
|
||||||
return io.EOF
|
return io.EOF
|
||||||
|
|
Loading…
Reference in New Issue