Skip to content

Commit

Permalink
Add _pid connection attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Daemonxiao committed Jan 31, 2023
1 parent c7744d6 commit 357e6a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions const.go
Expand Up @@ -25,6 +25,7 @@ const (
connAttrOSValue = runtime.GOOS
connAttrPlatform = "_platform"
connAttrPlatformValue = runtime.GOARCH
connAttrPid = "_pid"
)

// MySQL constants documentation:
Expand Down
4 changes: 4 additions & 0 deletions packets.go
Expand Up @@ -18,6 +18,8 @@ import (
"fmt"
"io"
"math"
"os"
"strconv"
"strings"
"time"
)
Expand Down Expand Up @@ -329,6 +331,8 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrOSValue)
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPlatform)
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPlatformValue)
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPid)
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, strconv.Itoa(os.Getpid()))

// user-defined connection attributes
for _, connAttr := range strings.Split(mc.cfg.ConnectionAttributes, ",") {
Expand Down

0 comments on commit 357e6a5

Please sign in to comment.