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
weir在首次建立与底层mysql连接的时候,没有设置字符集,只是把字符集设置成了属性,并没有实际调用set names 指令,可以看代码如下
weir/pkg/proxy/backend/client/conn.go
Line 70 in 89d789c
// Apply configuration functions. for i := range options { options[i](c) } if err = c.handshake(); err != nil { return nil, errors.Trace(err) } if err = c.SetCharset(constant.DefaultCharset); err != nil { return nil, errors.Trace(err) }
为什么这么改呢? SetCharset这个函数中有判断 if c.charset == charset { return nil } 所以如果c.charset = constant.DefaultCharset进行了赋值,也就是这个连接没有调用set names utf8mb4指令,当我们主动调用SetCharset(ctx, "utf8mb4")的时候,因为c.charset已经是utf8mb4了,就不会再往下执行,也就是不会发送 set name utf8mb4指令,从而导致字符集一次都没有设置过。
weir-proxy -V
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report
weir在首次建立与底层mysql连接的时候,没有设置字符集,只是把字符集设置成了属性,并没有实际调用set names 指令,可以看代码如下
weir/pkg/proxy/backend/client/conn.go
Line 70 in 89d789c
应该改为
c.charset = constant.DefaultCharset
这段删掉
在 handshake之后调用SetCharset,改完如下:
//c.charset = constant.DefaultCharset
为什么这么改呢?
SetCharset这个函数中有判断
if c.charset == charset {
return nil
}
所以如果c.charset = constant.DefaultCharset进行了赋值,也就是这个连接没有调用set names utf8mb4指令,当我们主动调用SetCharset(ctx, "utf8mb4")的时候,因为c.charset已经是utf8mb4了,就不会再往下执行,也就是不会发送 set name utf8mb4指令,从而导致字符集一次都没有设置过。
What did you do?
What did you expect to see?
What did you see instead?
What version of Weir are you using (
weir-proxy -V
)?The text was updated successfully, but these errors were encountered: