Skip to content

Commit

Permalink
Merge 71b6537 into f16ee58
Browse files Browse the repository at this point in the history
  • Loading branch information
arkie committed Nov 17, 2018
2 parents f16ee58 + 71b6537 commit fd57144
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
func newTextRows(c *conn, body io.ReadCloser, location *time.Location, useDBLocation bool) (*textRows, error) {
tsvReader := csv.NewReader(body)
tsvReader.Comma = '\t'
tsvReader.LazyQuotes = true

columns, err := tsvReader.Read()
if err != nil {
Expand Down
15 changes: 15 additions & 0 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,18 @@ func TestTextRows(t *testing.T) {
assert.NoError(t, rows.Close())
assert.Empty(t, data)
}

func TestTextRowsQuoted(t *testing.T) {
buf := bytes.NewReader([]byte("text\nArray(String)\n['Quote: \"here\"']"))
rows, err := newTextRows(&conn{}, &bufReadCloser{buf}, time.Local, false)
if !assert.NoError(t, err) {
return
}
assert.Equal(t, []string{"text"}, rows.Columns())
assert.Equal(t, []string{"Array(String)"}, rows.types)
dest := make([]driver.Value, 1)
if !assert.NoError(t, rows.Next(dest)) {
return
}
assert.Equal(t, []driver.Value{[]string{"Quote: \"here\""}}, dest)
}

0 comments on commit fd57144

Please sign in to comment.