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

err: sql: converting argument $1 type: unsupported type []uint64, a slice of uint64 #202

Open
242617 opened this issue Feb 28, 2018 · 4 comments

Comments

@242617
Copy link

242617 commented Feb 28, 2018

I have an error

err: sql: converting argument $1 type: unsupported type []uint64, a slice of uint64

while passing uint64 array into db.QueryRow.

var IDs []uint64
...
if err = db.QueryRow(query, IDs).Scan(&result); err != nil {
	return
}

How should I pass such a param?

@pvelder
Copy link
Contributor

pvelder commented Feb 28, 2018

Isn't the variadic syntax working, using "..." after IDs ?

var IDs []uint64
...
if err = db.QueryRow(query, IDs...).Scan(&result); err != nil {
    return
}

@242617
Copy link
Author

242617 commented Mar 1, 2018

Unfortunately. I have query like this:

SELECT COLUMN_VALUE AS AGT_ID
FROM TABLE(IDS_TAB(:1))
MINUS
SELECT AGT_ID
FROM TBL_1 TBL
WHERE TBL.PRS_ID = :2

And []uint64 are for :1 param.

@pvelder
Copy link
Contributor

pvelder commented Mar 1, 2018

OK, I see.

This is related to golang/go#16235.
See also commit "database/sql: allow drivers to support custom arg types" golang/go@a9bf3b2

@mattn don't see the interface driver.NamedValueChecker is implemented in go-oci8?

@mattn
Copy link
Owner

mattn commented Mar 1, 2018

don't see the interface driver.NamedValueChecker is implemented in go-oci8?

Yes, but always return true. Then, the slice will be converted (if I will implement converter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants