We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Config.FormatDSN does not take into account ConnectionAttributes property.
package main import ( "log" "github.com/go-sql-driver/mysql" ) func main() { testDSN := "usr/pwd@tcp(127.0.0.1:3306)/dbname?connectionAttributes=foo:bar" cfg, err := mysql.ParseDSN(testDSN) if err != nil { log.Fatal("something went really wrong") } if cfg.ConnectionAttributes == "foo:bar" { reformattedDSN := cfg.FormatDSN() if reformattedDSN != testDSN { log.Fatalf("Ooops, that's buggy\noriginalDSN = %q\nreformattedDSN = %q", testDSN, reformattedDSN) } } else { log.Fatal("I wasn't expecting this") } }
Running code from above will produce something like
2024/08/02 10:23:24 Ooops, that's buggy originalDSN = "usr/pwd@tcp(127.0.0.1:3306)/dbname?connectionAttributes=foo:bar" reformattedDSN = "usr/pwd@tcp(127.0.0.1:3306)/dbname"
Not relevant in this particular case, but still:
Driver version (or git SHA): 1.8.1
1.8.1
Go version: go1.22.4 darwin/arm64
go1.22.4 darwin/arm64
Server version: mysql Ver 8.4.0 for Linux on aarch64 (MySQL Community Server - GPL)
mysql Ver 8.4.0 for Linux on aarch64 (MySQL Community Server - GPL)
Server OS: linux c44dcabf32be 6.6.32-linuxkit #1 SMP Thu Jun 13 14:13:01 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
linux c44dcabf32be 6.6.32-linuxkit #1 SMP Thu Jun 13 14:13:01 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Issue description
Config.FormatDSN does not take into account ConnectionAttributes property.
Example code
Error log
Running code from above will produce something like
Configuration
Not relevant in this particular case, but still:
Driver version (or git SHA):
1.8.1
Go version:
go1.22.4 darwin/arm64
Server version:
mysql Ver 8.4.0 for Linux on aarch64 (MySQL Community Server - GPL)
Server OS:
linux c44dcabf32be 6.6.32-linuxkit #1 SMP Thu Jun 13 14:13:01 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
The text was updated successfully, but these errors were encountered: