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

database/sql/driver: someting is wrong in driver.ColumnConverter #20538

Closed
djadala opened this issue May 31, 2017 · 3 comments
Closed

database/sql/driver: someting is wrong in driver.ColumnConverter #20538

djadala opened this issue May 31, 2017 · 3 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@djadala
Copy link
Contributor

djadala commented May 31, 2017

The ColumnConverter interface does not have anything common with columns and column index.
Column index is actually bind argument index.
If driver implements this interface, and called with query like:

st.Exec(`select a from table where table.a in(?,?,?,?,?,?,?,?)`,1,2,3,4,5,6,7,8)

ColumnConverter is called with indexes from 1 to 8, but result have only 1 column.

For reference current godoc:

type ColumnConverter

ColumnConverter may be optionally implemented by Stmt if the statement is aware of its own columns' types and can convert from any type to a driver Value.

type ColumnConverter interface {
        // ColumnConverter returns a ValueConverter for the provided
        // column index. If the type of a specific column isn't known
        // or shouldn't be handled specially, DefaultValueConverter
        // can be returned.
        ColumnConverter(idx int) ValueConverter
}
@djadala
Copy link
Contributor Author

djadala commented Jun 1, 2017

just reveal that on tip, ColumnConverter interface is deprecated and NamedValueChecker is introduced,
I'm not sure what to do with this issue.
Close ?

@ALTree
Copy link
Member

ALTree commented Jun 1, 2017

cc @kardianos

@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 1, 2017
@ALTree ALTree added this to the Go1.9Maybe milestone Jun 1, 2017
@kardianos
Copy link
Contributor

ColumnConverter is used for input args for stmts. It was really limited. As you noted i recommend implementing named value checker, which again operates on arguments, not output columns.

@golang golang locked and limited conversation to collaborators Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants