Skip to content
New issue

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

修复ws计算包含中文字符串长度bug #97

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Driver/Impl/WebSocketMethods/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ public WSQueryResp BinaryQuery(string sql, ulong reqid = default)
//p0+24 uint16 version
//p0+26 uint32 sql_len
//p0+30 raw sql
var req = new byte[30 + sql.Length];
var src = Encoding.UTF8.GetBytes(sql);
var req = new byte[30 + src.Length];
WriteUInt64ToBytes(req, reqid, 0);
WriteUInt64ToBytes(req, 0, 8);
WriteUInt64ToBytes(req, WSActionBinary.BinaryQueryMessage, 16);
WriteUInt16ToBytes(req, 1, 24);
WriteUInt32ToBytes(req, (uint)sql.Length, 26);
Buffer.BlockCopy(Encoding.UTF8.GetBytes(sql), 0, req, 30, sql.Length);
WriteUInt32ToBytes(req, (uint)src.Length, 26);
Buffer.BlockCopy(src, 0, req, 30, src.Length);

return SendBinaryBackJson<WSQueryResp>(req);
}
Expand Down
Loading