Skip to content

Commit 51fc9ea

Browse files
committed
Care for null cases
1 parent e054deb commit 51fc9ea

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

executer.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,18 @@ func (e *Executer) queryContext(ctx context.Context, query string) error {
154154
}
155155
rows := make([][]string, 0)
156156
iRow := make([]interface{}, len(columns))
157+
sRow := make([]sql.NullString, len(columns))
158+
for i := range sRow {
159+
iRow[i] = &sRow[i]
160+
}
157161
for iter.Next() {
158-
row := make([]string, len(columns))
159-
for i := range row {
160-
iRow[i] = &row[i]
161-
}
162162
if err := iter.Scan(iRow...); err != nil {
163163
return err
164164
}
165+
row := make([]string, len(columns))
166+
for i := range row {
167+
row[i] = sRow[i].String
168+
}
165169
rows = append(rows, row)
166170
}
167171
e.selectHook(query, columns, rows)

0 commit comments

Comments
 (0)