aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxenoxeno <xeno@ydb.tech>2023-06-19 15:22:24 +0300
committerxenoxeno <xeno@ydb.tech>2023-06-19 15:22:24 +0300
commitca81e636171023fdd9db05fa40c0ce63b4413b3c (patch)
tree728da1cc07299cd8e2351e3c43de3bdef552775a
parentde64ef136314d3cec471dd7c88cd241291c9b331 (diff)
downloadydb-ca81e636171023fdd9db05fa40c0ce63b4413b3c.tar.gz
fix crash of utf8 function on utf8 encoding
-rw-r--r--ydb/core/local_pgwire/pgwire_kqp_proxy.cpp15
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);