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: no way to return the resultset column datatypes #6345

Closed
tgulacsi opened this issue Sep 7, 2013 · 5 comments
Closed

database/sql: no way to return the resultset column datatypes #6345

tgulacsi opened this issue Sep 7, 2013 · 5 comments

Comments

@tgulacsi
Copy link
Contributor

@tgulacsi tgulacsi commented Sep 7, 2013

Now we have database/sql.Rows.Columns() but that only returns the column names.
But although the database driver could return some more information about those columns,
I can't see any way to get it.

sql.Rows has a rowsi member (driver.Rows), and if the driver would implement a
ColumnDescriber (http://play.golang.org/p/NliYBvmg4J), and driver.Rows would propagate
it, OR sql.Rows would export a 

DriverRows() driver.Rows

or such method, than we could use database/sql AND have the infos from the underlying
drivers.


A possible workaround is to Scan the first row into some []interface{} and inspect the
returned values. But implementing this for each and every query with previously unknown
columns seems error prone and dubious.

What is the expected output?
database/sql.Rows.Columns 
What is the expected output?


What do you see instead?


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


Which operating system are you using?


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


Please provide any additional information below.
@tgulacsi
Copy link
Contributor Author

@tgulacsi tgulacsi commented Sep 7, 2013

Comment 1:

Sorry for the format.
I can't see any way to modify this issue...
@tgulacsi
Copy link
Contributor Author

@tgulacsi tgulacsi commented Sep 7, 2013

Comment 2:

Related threads:
https://groups.google.com/forum/?nomobile=true#!searchin/golang-nuts/database$2Fsql$20column$20data$20type
https://groups.google.com/forum/?nomobile=true#!searchin/golang-nuts/database$2Fsql$20column$20data$20type/golang-nuts/2aLctcVyp6Q/qyl4l7W_SS8J
@tgulacsi
Copy link
Contributor Author

@tgulacsi tgulacsi commented Sep 27, 2013

Comment 4:

Yes, seems to be a duplicate of issue #5606.
@rsc
Copy link
Contributor

@rsc rsc commented Oct 18, 2013

Comment 5:

Status changed to Duplicate.

Merged into issue #5606.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.