Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tds.Num into type *sql.RawBytes #20

Open
ashf opened this issue Jun 18, 2020 · 1 comment
Open

tds.Num into type *sql.RawBytes #20

ashf opened this issue Jun 18, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ashf
Copy link

ashf commented Jun 18, 2020

I am querying a table I don't know the schema of. So I am using this to gather the table contents:

cols, err := rows.Columns() // Remember to check err afterwards
vals := make([]interface{}, len(cols))
for i, _ := range cols {
	vals[i] = new(sql.RawBytes)
}

for rows.Next() {
	if err := rows.Scan(vals...); err != nil {
        // Check for a scan error.
	// Query rows will be closed with defer.
	log.Fatal(err)
	}
	log.Info(vals)
}

However when I get to a column with type money I get the following error:

unsupported Scan, storing driver.Value type tds.Num into type *sql.RawBytes

@thda thda added the enhancement New feature or request label Jun 19, 2020
@thda
Copy link
Owner

thda commented Jun 22, 2020

Thanks for reporting.
Could you please let me know what you plan to do with the rawBytes ?
It's a money type so I do not return the exact same data type as the one I receive on the wire.
For example you can perfectly scan to an array of interfaces, without populating it with rawByte values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants