{"action":"created","issue":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/366","labels_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/366/labels{/name}","comments_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/366/comments","events_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/366/events","html_url":"https://github.com/go-sql-driver/mysql/issues/366","id":102221206,"number":366,"title":"textRows.Next returns only []byte Values","user":{"login":"binary132","id":936243,"avatar_url":"https://avatars.githubusercontent.com/u/936243?v=3","gravatar_id":"","url":"https://api.github.com/users/binary132","html_url":"https://github.com/binary132","followers_url":"https://api.github.com/users/binary132/followers","following_url":"https://api.github.com/users/binary132/following{/other_user}","gists_url":"https://api.github.com/users/binary132/gists{/gist_id}","starred_url":"https://api.github.com/users/binary132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binary132/subscriptions","organizations_url":"https://api.github.com/users/binary132/orgs","repos_url":"https://api.github.com/users/binary132/repos","events_url":"https://api.github.com/users/binary132/events{/privacy}","received_events_url":"https://api.github.com/users/binary132/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T19:46:21Z","updated_at":"2015-08-20T20:44:57Z","closed_at":"2015-08-20T20:44:57Z","body":"I'm using the database/sql driver implementation on a *DB obtained using sql.Open.\r\n\r\nMy code looks a bit like this.\r\n\r\n```go\r\nvar dataRows []map[string]interface{}\r\nfor rowNum := 0; rows.Next(); rowNum++ {\r\n        newMap := make(map[string]interface{})\r\n        err = rows.MapScan(newMap)\r\n        // ...\r\n}\r\n\r\njson.Marshal(dataRows)\r\n// [{\"id\":\"MQ==\",\"name\":\"b28=\"},{\"id\":\"Mg==\",\"name\":\"cmVhbCBuYW1l\"}]\r\n// expected:\r\n// [{\"id\":1,\"name\":\"oo\"},{\"id\":2,\"name\":\"real name\"}]\r\n```\r\n\r\nAll values unmarshaled into dataRows are of `[]byte` type, including numbers, strings, etc.  This is causing problems.\r\n\r\nWould you be open to a pull request implementing the [type switch from `binaryRows`](https://github.com/go-sql-driver/mysql/blob/master/packets.go#L1039-L1175) on `textRows`?"},"comment":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/comments/133164937","html_url":"https://github.com/go-sql-driver/mysql/issues/366#issuecomment-133164937","issue_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/366","id":133164937,"user":{"login":"julienschmidt","id":944947,"avatar_url":"https://avatars.githubusercontent.com/u/944947?v=3","gravatar_id":"","url":"https://api.github.com/users/julienschmidt","html_url":"https://github.com/julienschmidt","followers_url":"https://api.github.com/users/julienschmidt/followers","following_url":"https://api.github.com/users/julienschmidt/following{/other_user}","gists_url":"https://api.github.com/users/julienschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/julienschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienschmidt/subscriptions","organizations_url":"https://api.github.com/users/julienschmidt/orgs","repos_url":"https://api.github.com/users/julienschmidt/repos","events_url":"https://api.github.com/users/julienschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/julienschmidt/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T20:44:57Z","updated_at":"2015-08-20T20:44:57Z","body":"No.\r\n\"textRows\" is used when the text protocol is used. MySQL has two protocols: The default text protocol and the newer binary protocol which is used for prepared statements.\r\n`[]byte` is returned since that is how the data from the MySQL server is received. All further type conversion is done by the database/sql package. Since you are using `interface{}` it is completely fine to put the `[]byte` value there."}}