From 40ee60a36538adaa617713abd4278a258a2ae7a3 Mon Sep 17 00:00:00 2001 From: Constantin Pan Date: Wed, 10 Oct 2018 17:14:24 +0100 Subject: [PATCH] Let the driver unescape type descriptions before parsing them --- conn_go18_test.go | 2 +- rows.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conn_go18_test.go b/conn_go18_test.go index 4b24f81..b10f27e 100644 --- a/conn_go18_test.go +++ b/conn_go18_test.go @@ -45,7 +45,7 @@ func (s *connSuite) TestColumnTypes() { s.Require().NoError(err) expected := []string{ "Int64", "UInt64", "Float64", "String", "String", "Array(Int16)", "Array(UInt8)", "Date", "DateTime", - `Enum8(\'one\' = 1, \'two\' = 2, \'three\' = 3)`, + "Enum8('one' = 1, 'two' = 2, 'three' = 3)", } s.Require().Equal(len(expected), len(types)) for i, e := range expected { diff --git a/rows.go b/rows.go index b4ec7f5..2bfc430 100644 --- a/rows.go +++ b/rows.go @@ -23,6 +23,12 @@ func newTextRows(c *conn, body io.ReadCloser, location *time.Location, useDBLoca if err != nil { return nil, err } + for i := range types { + types[i], err = readUnquoted(strings.NewReader(types[i]), 0) + if err != nil { + return nil, err + } + } parsers := make([]DataParser, len(types), len(types)) for i, typ := range types {