Skip to content

add support for type conversion for tinyint (boolean) in mysql to bool type in golang #440

Closed
@mglaske

Description

@mglaske

Issue description

currently, when there is a tinyint, or bit (boolean) field in mysql, you cannot store this type into a golang 'bool' type without error. Currently these are pulled in as string, or possibly int64.

Example code

var isEnabled bool
conn.Query('SELECT isEnabled FROM table')
rows.Scan(&isEnabled)

results in:
panic: sql: Scan error on column index 9: sql/driver: couldn't convert "\x01" into type bool

Error log

Configuration

*Driver version (or git SHA): 66312f7

Go version: go version go1.2.1 linux/amd64

Server version: MySQL 5.0.45

Server OS: Ubuntu 14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions