diff options
author | xenoxeno <xeno@ydb.tech> | 2023-06-19 15:22:24 +0300 |
---|---|---|
committer | xenoxeno <xeno@ydb.tech> | 2023-06-19 15:22:24 +0300 |
commit | ca81e636171023fdd9db05fa40c0ce63b4413b3c (patch) | |
tree | 728da1cc07299cd8e2351e3c43de3bdef552775a | |
parent | de64ef136314d3cec471dd7c88cd241291c9b331 (diff) | |
download | ydb-ca81e636171023fdd9db05fa40c0ce63b4413b3c.tar.gz |
fix crash of utf8 function on utf8 encoding
-rw-r--r-- | ydb/core/local_pgwire/pgwire_kqp_proxy.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp index 6f52ef66d5..8560f28171 100644 --- a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp +++ b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp @@ -53,13 +53,26 @@ protected: return event; } + TString ToUpperASCII(TStringBuf s) { + TString r; + r.resize(s.size()); + for (size_t i = 0; i < s.size(); ++i) { + if (s[i] <= 0x7f && s[i] >= 0x20) { + r[i] = toupper(s[i]); + } else { + r[i] = s[i]; + } + } + return r; + } + void ConvertQueryToRequest(TStringBuf query, NKikimrKqp::TQueryRequest& request) { if (Connection_.SessionId) { request.SetSessionId(Connection_.SessionId); } request.SetKeepSession(true); // HACK - TString q(ToUpperUTF8(query.substr(0, 10))); + TString q(ToUpperASCII(query.substr(0, 10))); if (q.StartsWith("BEGIN")) { Tag_ = "BEGIN"; request.SetAction(NKikimrKqp::QUERY_ACTION_BEGIN_TX); |