Skip to content

Commit

Permalink
feat(mysql): bump github.com/go-sql-driver/mysql from 1.7.1 to 1.8.1 (#…
Browse files Browse the repository at this point in the history
…11)

Bumps
[github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
from 1.7.1 to 1.8.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/go-sql-driver/mysql/releases">github.com/go-sql-driver/mysql's
releases</a>.</em></p>
<blockquote>
<h2>v1.8.0</h2>
<h2>What's Changed</h2>
<h2>Major changes</h2>
<ul>
<li>
<p>Use <code>SET NAMES charset COLLATE collation</code>. by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1437">go-sql-driver/mysql#1437</a></p>
<ul>
<li>Older go-mysql-driver used <code>collation_id</code> in the
handshake packet. But it caused collation mismatch in some
situation.</li>
<li>If you don't specify charset nor collation, go-mysql-driver sends
<code>SET NAMES utf8mb4</code> for new connection. This uses server's
default collation for utf8mb4.</li>
<li>If you specify charset, go-mysql-driver sends <code>SET NAMES
&lt;charset&gt;</code>. This uses the server's default collation for
<code>&lt;charset&gt;</code>.</li>
<li>If you specify collation and/or charset, go-mysql-driver sends
<code>SET NAMES charset COLLATE collation</code>.</li>
</ul>
</li>
<li>
<p>PathEscape dbname in DSN. by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1432">go-sql-driver/mysql#1432</a></p>
<ul>
<li>This is backward incompatible in rare case. Check your DSN.</li>
</ul>
</li>
<li>
<p>Drop Go 1.13-17 support by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1420">go-sql-driver/mysql#1420</a></p>
<ul>
<li>Use Go 1.18+</li>
</ul>
</li>
<li>
<p>Parse numbers on text protocol too by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1452">go-sql-driver/mysql#1452</a></p>
<ul>
<li>When text protocol is used, go-mysql-driver passed bare
<code>[]byte</code> to database/sql for avoid unnecessary allocation and
conversion.</li>
<li>If user specified <code>*any</code> to <code>Scan()</code>,
database/sql passed the <code>[]byte</code> into the target
variabe.</li>
<li>This confused users because most user doesn't know when text/binary
protocol used.</li>
<li>go-mysql-driver 1.8 converts integer/float values into int64/double
even in text protocol. This doesn't increase allocation compared to
<code>[]byte</code> and conversion cost is negilible.</li>
</ul>
</li>
<li>
<p>New options start using the Functional Option Pattern to avoid
increasing technical debt in the Config object. Future version may
introduce Functional Option for existing options, but not for now.</p>
<ul>
<li>Make TimeTruncate functional option by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1552">go-sql-driver/mysql#1552</a></li>
<li>Add BeforeConnect callback to configuration object by <a
href="https://github.com/ItalyPaleAle"><code>@​ItalyPaleAle</code></a>
in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1469">go-sql-driver/mysql#1469</a></li>
</ul>
</li>
</ul>
<h3>Other changes</h3>
<ul>
<li>
<p>Adding DeregisterDialContext to prevent memory leaks with dialers we
don't need anymore by <a
href="https://github.com/jypelle"><code>@​jypelle</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1422">go-sql-driver/mysql#1422</a></p>
</li>
<li>
<p>Make logger configurable per connection by <a
href="https://github.com/frozenbonito"><code>@​frozenbonito</code></a>
in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1408">go-sql-driver/mysql#1408</a></p>
</li>
<li>
<p>Fix ColumnType.DatabaseTypeName for mediumint unsigned by <a
href="https://github.com/evanelias"><code>@​evanelias</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1428">go-sql-driver/mysql#1428</a></p>
</li>
<li>
<p>Add connection attributes by <a
href="https://github.com/Daemonxiao"><code>@​Daemonxiao</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1389">go-sql-driver/mysql#1389</a></p>
</li>
<li>
<p>Stop <code>ColumnTypeScanType()</code> from returning
<code>sql.RawBytes</code> by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1424">go-sql-driver/mysql#1424</a></p>
</li>
<li>
<p>Exec() now provides access to status of multiple statements. by <a
href="https://github.com/mherr-google"><code>@​mherr-google</code></a>
in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1309">go-sql-driver/mysql#1309</a></p>
</li>
<li>
<p>Allow to change (or disable) the default driver name for registration
by <a href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1499">go-sql-driver/mysql#1499</a></p>
</li>
<li>
<p>Add default connection attribute '_server_host' by <a
href="https://github.com/oblitorum"><code>@​oblitorum</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1506">go-sql-driver/mysql#1506</a></p>
</li>
<li>
<p>QueryUnescape DSN ConnectionAttribute value by <a
href="https://github.com/zhangyangyu"><code>@​zhangyangyu</code></a> in
<a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1470">go-sql-driver/mysql#1470</a></p>
</li>
<li>
<p>Add client_ed25519 authentication by <a
href="https://github.com/Gusted"><code>@​Gusted</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1518">go-sql-driver/mysql#1518</a></p>
</li>
<li>
<p>Reduced allocation on connection.go by <a
href="https://github.com/EPuncker"><code>@​EPuncker</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1421">go-sql-driver/mysql#1421</a></p>
</li>
<li>
<p>Avoid panic in TestRowsColumnTypes by <a
href="https://github.com/wayyoungboy"><code>@​wayyoungboy</code></a> in
<a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1426">go-sql-driver/mysql#1426</a></p>
</li>
<li>
<p>Add benchmark to receive massive rows. by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1415">go-sql-driver/mysql#1415</a></p>
</li>
<li>
<p>README: Update multistatement by <a
href="https://github.com/methane"><code>@​methane</code></a> in <a
href="https://redirect.github.com/go-sql-driver/mysql/pull/1431">go-sql-driver/mysql#1431</a></p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/33b7747a9144946e50399904d3f27ecc0f96c2b6"><code>33b7747</code></a>
Add BeforeConnect callback to configuration object (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1469">#1469</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/6964272ffd13a41ad66383cd2ea738fded75ad06"><code>6964272</code></a>
Make TimeTruncate functional option (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1552">#1552</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/097fe6e3ad83bbd7c84debe810aec4c4a533bcaa"><code>097fe6e</code></a>
Update workflows (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1547">#1547</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/f019727e4706bf9c4f60579382f6e72b94bd0305"><code>f019727</code></a>
add TiDB support in README.md (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1333">#1333</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/743e263bab87912dfb61789f36c21d9685887c76"><code>743e263</code></a>
Introduce <code>timeTruncate</code> parameter for <code>time.Time</code>
arguments (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1541">#1541</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/c48c0e7da17e8fc06133e431ce7c10e7a3e94f06"><code>c48c0e7</code></a>
Fix unsigned int overflow (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1530">#1530</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/0004702b931d3429afb3e16df444ed80be24d1f4"><code>0004702</code></a>
Parallelize test (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1525">#1525</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/d4517c5d905ccd3cc1e750f592edfa88d774d908"><code>d4517c5</code></a>
Support ENUM and SET type in DatabaseTypeName() (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1520">#1520</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/2cdf62442f2edb873d1270897d994fc83b78f118"><code>2cdf624</code></a>
Fix sql.RawBytes corruption issue (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1523">#1523</a>)</li>
<li><a
href="https://github.com/go-sql-driver/mysql/commit/fc589cbaba22032382488393c72b9b3b5366917c"><code>fc589cb</code></a>
Add client_ed25519 authentication (<a
href="https://redirect.github.com/go-sql-driver/mysql/issues/1518">#1518</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/go-sql-driver/mysql/compare/v1.7.1...v1.8.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/go-sql-driver/mysql&package-manager=go_modules&previous-version=1.7.1&new-version=1.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

> **Note**
> Automatic rebases have been disabled on this pull request as it has
been open for over 30 days.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aris Tzoumas <atzoumas@rudderstack.com>
  • Loading branch information
dependabot[bot] and atzoum authored May 20, 2024
1 parent eda4cf6 commit de51b3a
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
check-latest: true
- run: go version
- run: go mod download
- name: disable ipv6
run: |
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
- name: Run tests
run: |
FORCE_RUN_INTEGRATION_TESTS=true make test exclude="${{ matrix.exclude }}" package=${{ matrix.package }}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/databricks/databricks-sql-go v1.5.5
github.com/dlclark/regexp2 v1.11.0
github.com/gliderlabs/ssh v0.3.7
github.com/go-sql-driver/mysql v1.7.1
github.com/go-sql-driver/mysql v1.8.1
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
github.com/ory/dockertest/v3 v3.10.0
Expand All @@ -40,6 +40,7 @@ require (
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.7 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ cloud.google.com/go/storage v1.40.0 h1:VEpDQV5CJxFmJ6ueWNsKxcr1QAYOXEgxDa+sBbJah
cloud.google.com/go/storage v1.40.0/go.mod h1:Rrj7/hKlG87BLqDJYtwR0fbPld8uJPbQ2ucUMY7Ir0g=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XBn0=
Expand Down Expand Up @@ -161,8 +163,8 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
Expand Down
34 changes: 33 additions & 1 deletion sqlconnect/internal/mysql/legacy_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mysql

import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
Expand All @@ -13,8 +14,9 @@ func legacyJsonRowMapper(databaseTypeName string, value any) any {
return nil
}
databaseTypeName = strings.Replace(databaseTypeName, "UNSIGNED ", "", 1)

switch databaseTypeName {
case "CHAR", "VARCHAR", "BLOB", "TEXT", "TINYBLOB", "TINYTEXT", "MEDIUMBLOB", "MEDIUMTEXT", "LONGBLOB", "LONGTEXT", "ENUM":
case "CHAR", "VARCHAR", "BLOB", "TEXT", "TINYBLOB", "TINYTEXT", "MEDIUMBLOB", "MEDIUMTEXT", "LONGBLOB", "LONGTEXT", "ENUM", "SET":
switch v := value.(type) {
case []uint8:
return string(v)
Expand All @@ -23,6 +25,8 @@ func legacyJsonRowMapper(databaseTypeName string, value any) any {
}
case "DATE", "DATETIME", "TIMESTAMP", "TIME", "YEAR":
switch v := value.(type) {
case int, int32, int64, uint32, uint64:
return fmt.Sprintf("%d", v)
case []uint8:
return string(v)
default:
Expand All @@ -31,6 +35,18 @@ func legacyJsonRowMapper(databaseTypeName string, value any) any {

case "FLOAT", "DOUBLE", "DECIMAL":
switch v := value.(type) {
case int, int32, int64, uint32, uint64:
n, err := strconv.ParseFloat(fmt.Sprintf("%d", v), 64)
if err != nil {
panic(err)
}
return n
case float32, float64:
n, err := strconv.ParseFloat(fmt.Sprintf("%f", v), 64)
if err != nil {
panic(err)
}
return n
case []uint8:
n, err := strconv.ParseFloat(string(v), 64)
if err != nil {
Expand All @@ -46,6 +62,12 @@ func legacyJsonRowMapper(databaseTypeName string, value any) any {
}
case "INT", "TINYINT", "SMALLINt", "MEDIUMINT", "BIGINT", "UNSIGNED BIGINT":
switch v := value.(type) {
case int, int32, int64, uint32, uint64:
n, err := strconv.ParseInt(fmt.Sprintf("%d", v), 10, 64)
if err != nil {
panic(err)
}
return n
case []uint8:
n, err := strconv.ParseInt(string(v), 10, 64)
if err != nil {
Expand All @@ -59,6 +81,16 @@ func legacyJsonRowMapper(databaseTypeName string, value any) any {
}
return n
}
case "SMALLINT":
switch v := value.(type) {
case int, int32, int64, uint32, uint64:
// converting to []byte to be backwards compatible
return []byte(fmt.Sprintf("%d", v))
case float32, float64:
// converting to []byte to be backwards compatible
return []byte(fmt.Sprintf("%f", v))
}

}

return value
Expand Down
13 changes: 13 additions & 0 deletions sqlconnect/internal/mysql/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mysql
import (
"encoding/binary"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -70,6 +71,12 @@ func jsonRowMapper(databaseTypeName string, value interface{}) interface{} {
stringValue = v.String()
case string:
stringValue = v
case int, int32, int64, uint32, uint64:
stringValue = fmt.Sprintf("%d", v)
case float32, float64:
stringValue = fmt.Sprintf("%f", v)
default:
return value
}

switch databaseTypeName {
Expand Down Expand Up @@ -100,12 +107,18 @@ func jsonRowMapper(databaseTypeName string, value interface{}) interface{} {
case "JSON":
return json.RawMessage(stringValue)
case "FLOAT", "DOUBLE", "DECIMAL":
if stringValue == "" {
return nil
}
n, err := strconv.ParseFloat(stringValue, 64)
if err != nil {
panic(err)
}
return n
case "INT", "TINYINT", "SMALLINT", "MEDIUMINT", "BIGINT":
if stringValue == "" {
return nil
}
n, err := strconv.ParseInt(stringValue, 10, 64)
if err != nil {
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"_tinytext": "TEXT",
"_mediumtext": "TEXT",
"_longtext": "TEXT",
"_enum": "CHAR",
"_set": "CHAR",
"_enum": "ENUM",
"_set": "SET",
"_date": "DATE",
"_datetime": "DATETIME",
"_timestamp": "TIMESTAMP",
Expand Down
21 changes: 21 additions & 0 deletions sqlconnect/internal/sshtunnel/tcp_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net"
"strconv"
"time"

"github.com/rudderlabs/sql-tunnels/tunnel"
)
Expand All @@ -24,10 +25,30 @@ func NewTcpTunnel(c Config, remoteHost string, remotePort int) (Tunnel, error) {
RemoteHost: remoteHost,
RemotePort: remotePort,
}

t, err := tunnel.ListenAndForward(&tunnelConfig)
if err != nil {
return nil, fmt.Errorf("creating ssh tunnel: %w", err)
}

// Wait for the tunnel to be ready (go routine)
var (
established bool
retries int
)
for !established && retries < 10 {
con, err := net.Dial("tcp", t.Addr())
if con != nil {
_ = con.Close()
}
if err != nil {
retries++
time.Sleep(10 * time.Millisecond)
continue
}
established = true
}

return &tcpTunnel{t}, nil
}

Expand Down

0 comments on commit de51b3a

Please sign in to comment.