Skip to content

Commit 8863717

Browse files
committed
fix single row
1 parent 768a3cb commit 8863717

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/xsql/rows.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ func (r *rows) Close() error {
114114
}
115115

116116
type single struct {
117-
values []sql.NamedArg
117+
values []sql.NamedArg
118+
readAll bool
118119
}
119120

120121
func (r *single) Columns() (columns []string) {
@@ -129,12 +130,12 @@ func (r *single) Close() error {
129130
}
130131

131132
func (r *single) Next(dst []driver.Value) error {
132-
if r.values == nil {
133+
if r.values == nil || r.readAll {
133134
return io.EOF
134135
}
135136
for i := range r.values {
136137
dst[i] = r.values[i].Value
137138
}
138-
r.values = nil
139+
r.readAll = true
139140
return nil
140141
}

0 commit comments

Comments
 (0)