diff options
Diffstat (limited to 'storage/rocksdb/rdb_utils.cc')
-rw-r--r-- | storage/rocksdb/rdb_utils.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/rocksdb/rdb_utils.cc b/storage/rocksdb/rdb_utils.cc index 900d0f9be19..daa766ad871 100644 --- a/storage/rocksdb/rdb_utils.cc +++ b/storage/rocksdb/rdb_utils.cc @@ -20,6 +20,7 @@ /* C++ standard header files */ #include <array> #include <string> +#include <vector> /* C standard header files */ #include <ctype.h> @@ -212,6 +213,22 @@ const char *rdb_skip_id(const struct charset_info_st *const cs, return rdb_parse_id(cs, str, nullptr); } +/* + Parses a given string into tokens (if any) separated by a specific delimiter. +*/ +const std::vector<std::string> parse_into_tokens( + const std::string& s, const char delim) { + std::vector<std::string> tokens; + std::string t; + std::stringstream ss(s); + + while (getline(ss, t, delim)) { + tokens.push_back(t); + } + + return tokens; +} + static const std::size_t rdb_hex_bytes_per_char = 2; static const std::array<char, 16> rdb_hexdigit = {{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', |