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

proposal: database/sql: add ConnetcionID() #31322

Closed
hanchuanchuan opened this issue Apr 7, 2019 · 3 comments
Closed

proposal: database/sql: add ConnetcionID() #31322

hanchuanchuan opened this issue Apr 7, 2019 · 3 comments

Comments

@hanchuanchuan
Copy link

@hanchuanchuan hanchuanchuan commented Apr 7, 2019

When I create a connection, I want to get the connection ID, which may have been multiple times.
Is it possible to implement ConnectionID()?
Poor efficiency when using select connection_id() multiple times.

Go version go1.12.1 linux/amd64

@gopherbot gopherbot added this to the Proposal milestone Apr 7, 2019
@gopherbot gopherbot added the Proposal label Apr 7, 2019
@kardianos
Copy link
Contributor

@kardianos kardianos commented Apr 7, 2019

Probably not. Either grab a DB.Conn and manually associate the ID once per connection, or wait for a potential conn.raw call.

@kardianos
Copy link
Contributor

@kardianos kardianos commented Apr 8, 2019

Was this resolved?

@hanchuanchuan
Copy link
Author

@hanchuanchuan hanchuanchuan commented Apr 9, 2019

Thanks! the problem has been solved!
When I found that a new connection is used, I will query the connection ID once.
go-sql-driver/mysql#946 (comment)

@agnivade agnivade closed this Apr 9, 2019
@golang golang locked and limited conversation to collaborators Apr 8, 2020
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
4 participants
You can’t perform that action at this time.