Skip to content

Commit fcc33de

Browse files
author
sabdenovch
committed
YT-24943: Parser for short type notation implemented
commit_hash:d82e8ca36682e9d42f95178ac93b69f913b9d14a
1 parent 2f8f499 commit fcc33de

File tree

6 files changed

+698
-61
lines changed

6 files changed

+698
-61
lines changed

yt/yt/client/table_client/helpers.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,4 +1687,29 @@ void SetBit(TMutableRef bitmap, i64 index, bool value)
16871687

16881688
////////////////////////////////////////////////////////////////////////////////
16891689

1690+
TString EscapeCAndSingleQuotes(TStringBuf str)
1691+
{
1692+
auto escaped = TString();
1693+
escaped.reserve(str.size() * 2);
1694+
1695+
EscapeC(str, escaped);
1696+
1697+
auto size = escaped.size();
1698+
auto newSize = size + std::count(escaped.cbegin(), escaped.cend(), '\'');
1699+
1700+
escaped.resize(newSize);
1701+
1702+
auto rit = escaped.rbegin();
1703+
std::for_each(rit + (newSize - size), escaped.rend(), [&] (char character) {
1704+
*rit++ = character;
1705+
if (character == '\'') {
1706+
*rit++ = '\\';
1707+
}
1708+
});
1709+
1710+
return escaped;
1711+
}
1712+
1713+
////////////////////////////////////////////////////////////////////////////////
1714+
16901715
} // namespace NYT::NTableClient

yt/yt/client/table_client/helpers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ void SetBit(TMutableRef bitmap, i64 index, bool value);
398398

399399
////////////////////////////////////////////////////////////////////////////////
400400

401+
TString EscapeCAndSingleQuotes(TStringBuf str);
402+
403+
////////////////////////////////////////////////////////////////////////////////
404+
401405
} // namespace NYT::NTableClient
402406

403407
#define HELPERS_INL_H_

0 commit comments

Comments
 (0)