Skip to content

database/sql/driver: Scan.Next documentation incorrect #6497

@gopherbot

Description

@gopherbot

by Christopher.Pfohl:

What is the expected output?

String types from a database should have a go type of 'string' in Scanner.Scan.

What do you see instead?

String types have a go type of `[]byte`

Which compiler are you using (5g, 6g, 8g, gccgo)?

Whatever installed when I apt-get'ed from ppa:duh/golang

Which operating system are you using?

Ubuntu 13.04

Which version are you using?  (run 'go version')

1.1.1 linux/amd64

Please provide any additional information below.

database/sql/driver.Rows.Next's documentation states that all strings ought to be
converted to []byte

database/sql.Scanner.Scan's documentation suggests that a string is a legitimate type to
expect...but all the types that actually *are* strings actually wind up being []byte
because the driver's obey the above documentation (see mgodbc for a case in point, line
916).

Note, that removing the conversion to []byte still works, so I suspect that the
database/sql/driver.Rows.Next documentation is simply out of date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions