Skip to content

Commit

Permalink
Merge pull request #97 from LFDCC/fix_ws中文字符
Browse files Browse the repository at this point in the history
fix: ws calculate sql length bug
  • Loading branch information
huskar-t authored Jan 7, 2025
2 parents 4366786 + 8535b11 commit be3b15e
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit be3b15e

Please sign in to comment.