Skip to content

Commit 357e6a5

Browse files
committed
Add _pid connection attribute
1 parent c7744d6 commit 357e6a5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

const.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const (
2525
connAttrOSValue = runtime.GOOS
2626
connAttrPlatform = "_platform"
2727
connAttrPlatformValue = runtime.GOARCH
28+
connAttrPid = "_pid"
2829
)
2930

3031
// MySQL constants documentation:

packets.go

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
"fmt"
1919
"io"
2020
"math"
21+
"os"
22+
"strconv"
2123
"strings"
2224
"time"
2325
)
@@ -329,6 +331,8 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
329331
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrOSValue)
330332
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPlatform)
331333
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPlatformValue)
334+
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPid)
335+
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, strconv.Itoa(os.Getpid()))
332336

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

0 commit comments

Comments
 (0)