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

Support DSN without 'user:password@' #888

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

dvilaverde
Copy link
Contributor

@dvilaverde dvilaverde commented Jun 12, 2024

I noticed that a DSN like this:

db.example.com:3307/db?ssl=true

would incorrectly have the property db in the connInfo object set to ssl=true when it should have been set to db.

According to the README the DSN format allows for an optional user:password@.

[user[:password]@]addr[/db[?param=X]]

Adding unit tests for the ParseDSN function to cover those cases.

@@ -368,6 +368,14 @@ Configuration options can be provided by the standard DSN (Data Source Name).
[user[:password]@]addr[/db[?param=X]]
```

#### `collation`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i forgot to add this connection param in my previous commits

@@ -285,10 +285,8 @@ func (c *Conn) writeAuthHandshake() error {
return fmt.Errorf("invalid collation name %s", collationName)
}

// the MySQL protocol calls for the collation id to be sent as 1, where only the
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updating this comment which was incorrect regarding the first byte of the 23 bytes of filter being used to store the right 8 bits of the collation id.

@lance6716 lance6716 merged commit 2e5c5ac into go-mysql-org:master Jun 14, 2024
13 checks passed
@dvilaverde dvilaverde deleted the parse_dsn_fix branch June 23, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants