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

Add support for connection attributes. #343

Closed
wants to merge 1 commit into from

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented May 28, 2015

This sets attribute _client_name with the value "Go MySQL Driver"
Also sets _os, _platform, _pid and program_name by default.

This supersedes #333

@@ -228,7 +233,22 @@ func (mc *mysqlConn) writeAuthPacket(cipher []byte) error {
// User Password
scrambleBuff := scramblePassword(cipher, []byte(mc.cfg.passwd))

attrs := make(map[string]string)
attrs["_os"] = runtime.GOOS
attrs["_client_name"] = "Go MySQL Driver"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go-MySQL-Driver

@shlomi-noach
Copy link

Just noting on the importance of the feature (regardless of the code review itself), as connection attributes turn to be standard in the C library; and can contain such information that is otherwise unachievable via MySQL elsewise (e.g. provide true hostname while connecting behind proxy; e.g. process ID of course).

dveeden added a commit to dveeden/go-mysql-driver that referenced this pull request Jun 8, 2015
dveeden added a commit to dveeden/go-mysql-driver that referenced this pull request Jun 9, 2015
This sets attribute _client_name with the value "Go MySQL Driver"
Also sets _os, _platform, _pid and program_name by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants