OmniSciDB  17c254d2f8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StringTransform.h File Reference
#include "Logger.h"
#include <boost/config.hpp>
#include <boost/regex.hpp>
#include <optional>
#include <string_view>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
+ Include dependency graph for StringTransform.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 anonymous_namespace{StringTransform.h}
 

Functions

void apply_shim (std::string &result, const boost::regex &reg_expr, const std::function< void(std::string &, const boost::smatch &)> &shim_fn)
 
template<typename... Ts>
std::string cat (Ts &&...args)
 
std::vector< std::pair< size_t,
size_t > > 
find_string_literals (const std::string &query)
 
std::string hide_sensitive_data_from_query (std::string const &query_str)
 
ssize_t inside_string_literal (const size_t start, const size_t length, const std::vector< std::pair< size_t, size_t >> &literal_positions)
 
template<typename T >
std::string join (T const &container, std::string const &delim)
 
template<typename T >
std::string to_string (T &&v)
 
template<>
std::string to_string (char const *&&v)
 
template<>
std::string to_string (std::string &&v)
 
std::string to_upper (const std::string &str)
 
std::string to_lower (const std::string &str)
 
std::string generate_random_string (const size_t len)
 
std::vector< std::string > split (std::string_view str, std::string_view delim={}, std::optional< size_t > maxsplit=std::nullopt)
 split apart a string into a vector of substrings More...
 
std::string strip (std::string_view str)
 trim any whitespace from the left and right ends of a string More...
 
bool remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string (std::string &str) noexcept
 sanitize an SQL string More...
 
bool unquote (std::string &)
 
template<typename T >
decltype(auto) anonymous_namespace{StringTransform.h}::stringlike (T &&parm)
 
template<typename... Types>
std::string concat (Types &&...parms)
 
template<typename... Types>
std::string concat_with (std::string_view with, Types &&...parms)
 

Function Documentation

void apply_shim ( std::string &  result,
const boost::regex &  reg_expr,
const std::function< void(std::string &, const boost::smatch &)> &  shim_fn 
)

Definition at line 23 of file StringTransform.cpp.

References find_string_literals(), and inside_string_literal().

Referenced by QueryRunner::apply_copy_to_shim(), DBHandler::apply_copy_to_shim(), and anonymous_namespace{CalciteAdapter.cpp}::pg_shim_impl().

25  {
26  boost::smatch what;
27  std::vector<std::pair<size_t, size_t>> lit_pos = find_string_literals(result);
28  auto start_it = result.cbegin();
29  auto end_it = result.cend();
30  while (true) {
31  if (!boost::regex_search(start_it, end_it, what, reg_expr)) {
32  break;
33  }
34  const auto next_start =
35  inside_string_literal(what.position(), what.length(), lit_pos);
36  if (next_start >= 0) {
37  start_it = result.cbegin() + next_start;
38  } else {
39  shim_fn(result, what);
40  lit_pos = find_string_literals(result);
41  start_it = result.cbegin();
42  end_it = result.cend();
43  }
44  }
45 }
ssize_t inside_string_literal(const size_t start, const size_t length, const std::vector< std::pair< size_t, size_t >> &literal_positions)
std::vector< std::pair< size_t, size_t > > find_string_literals(const std::string &query)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename... Ts>
std::string cat ( Ts &&...  args)

Definition at line 42 of file StringTransform.h.

References run_benchmark_import::args.

Referenced by DBHandler::check_table_load_privileges(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), DBHandler::checkpoint(), DBHandler::clone_session(), anonymous_namespace{InputMetadata.cpp}::collect_table_infos(), QueryCompilationDescriptor::compile(), DBHandler::connect(), Fragmenter_Namespace::copyDataOfShard(), DBHandler::create_dashboard(), DBHandler::create_link(), Catalog_Namespace::SysCatalog::createDatabase(), DBHandler::delete_dashboard(), anonymous_namespace{RelAlgExecutor.cpp}::do_table_reordering(), Catalog_Namespace::SysCatalog::dropDatabase(), DBHandler::execute_rel_alg(), DBHandler::execute_rel_alg_df(), anonymous_namespace{GroupByAndAggregate.cpp}::expr_is_rowid(), Executor::fetchChunks(), Executor::fetchUnionChunks(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), DBHandler::get_dashboards(), DBHandler::get_db_object_privs(), DBHandler::get_link_view(), DBHandler::get_table_details_impl(), DBHandler::get_table_epoch(), DBHandler::get_table_epoch_by_name(), DBHandler::get_tables_meta_impl(), DBHandler::get_valid_groups(), Calcite::getCompletionHints(), QueryRunner::QueryRunner::getExecutor(), QueryRunner::QueryRunner::getLoader(), ColumnFetcher::getOneTableColumnFragment(), lockmgr::TableLockMgrImpl< TableDataLockMgr >::getReadLockForTable(), InputTableInfoCache::getTableInfo(), lockmgr::TableLockMgrImpl< TableDataLockMgr >::getWriteLockForTable(), DBHandler::has_object_privilege(), DBHandler::hasTableAccessPrivileges(), DBHandler::import_geo_table(), DBHandler::import_table(), QueryRunner::ImportDriver::importGeoTable(), DBHandler::insert_data(), Fragmenter_Namespace::InsertDataLoader::insertData(), DBHandler::internal_connect(), DBHandler::interrupt(), DBHandler::load_table(), DBHandler::load_table_binary(), DBHandler::load_table_binary_columnar(), main(), migrations::MigrationMgr::migrateDateInDaysMetadata(), normalize_column_pair(), normalize_column_pairs(), DBHandler::parse_to_ra(), DBHandler::prepare_columnar_loader(), Calcite::processImpl(), QueryRunner::QueryRunner::QueryRunner(), DBHandler::replace_dashboard(), QueryRewriter::rewriteColumnarUpdate(), QueryRunner::anonymous_namespace{QueryRunner.cpp}::run_select_query_with_filter_push_down(), QueryRunner::QueryRunner::runSelectQuery(), QueryRunner::QueryRunner::runSQLWithAllowingInterrupt(), Importer_NS::RenderGroupAnalyzer::seedFromExistingTableContents(), Catalog_Namespace::Catalog::set(), DBHandler::set_table_epoch(), DBHandler::set_table_epoch_by_name(), DBHandler::share_dashboard(), DBHandler::sql_execute_impl(), DBHandler::switch_database(), Catalog_Namespace::SysCatalog::switchDatabase(), anonymous_namespace{QueryMemoryDescriptor.cpp}::target_expr_proj_indices(), RelLogicalUnion::toString(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources_for_update(), DBHandler::unshare_dashboard(), and DBHandler::user_can_access_table().

42  {
43  std::ostringstream oss;
44 #ifdef BOOST_NO_CXX17_FOLD_EXPRESSIONS
45  (void)(int[]){0, ((void)(oss << std::forward<Ts>(args)), 0)...};
46 #else
47  (oss << ... << std::forward<Ts>(args));
48 #endif
49  return oss.str();
50 }
template<typename... Types>
std::string concat ( Types &&...  parms)

Definition at line 165 of file StringTransform.h.

References File_Namespace::append(), and anonymous_namespace{StringTransform.h}::stringlike().

Referenced by SQLTypeInfo::to_string().

165  {
166  struct Joiner {
167  Joiner() {}
168 
169  std::string txt;
170 
171  void append(std::string_view moretxt) { txt += moretxt; }
172  }; // struct Joiner
173  Joiner j{};
174  (j.append(stringlike(std::forward<Types>(parms))), ...);
175  return std::move(j.txt);
176 }
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:135

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename... Types>
std::string concat_with ( std::string_view  with,
Types &&...  parms 
)

Definition at line 179 of file StringTransform.h.

References File_Namespace::append(), join(), and anonymous_namespace{StringTransform.h}::stringlike().

179  {
180  struct JoinerWith {
181  JoinerWith(std::string_view join) : join(join), first(true) {}
182 
183  std::string_view join;
184  bool first;
185  std::string txt;
186 
187  void append(std::string_view moretxt) {
188  if (!first) {
189  txt += join;
190  } else {
191  first = false;
192  }
193  txt += moretxt;
194  }
195  }; // struct JoinerWith
196  JoinerWith j{with};
197  (j.append(stringlike(std::forward<Types>(parms))), ...);
198  return std::move(j.txt);
199 }
std::string join(T const &container, std::string const &delim)
size_t append(FILE *f, const size_t size, int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:135
bool g_enable_smem_group_by true

+ Here is the call graph for this function:

std::vector<std::pair<size_t, size_t> > find_string_literals ( const std::string &  query)

Definition at line 47 of file StringTransform.cpp.

References CHECK_GT.

Referenced by apply_shim().

47  {
48  boost::regex literal_string_regex{R"(([^']+)('(?:[^']+|'')+'))", boost::regex::perl};
49  boost::smatch what;
50  auto it = query.begin();
51  auto prev_it = it;
52  std::vector<std::pair<size_t, size_t>> positions;
53  while (true) {
54  if (!boost::regex_search(it, query.end(), what, literal_string_regex)) {
55  break;
56  }
57  CHECK_GT(what[1].length(), 0);
58  prev_it = it;
59  it += what.length();
60  positions.emplace_back(prev_it + what[1].length() - query.begin(),
61  it - query.begin());
62  }
63  return positions;
64 }
#define CHECK_GT(x, y)
Definition: Logger.h:209

+ Here is the caller graph for this function:

std::string generate_random_string ( const size_t  len)

Definition at line 102 of file StringTransform.cpp.

Referenced by DBHandler::create_new_session(), DBHandler::createInMemoryCalciteSession(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), and Catalog_Namespace::SysCatalog::updateBlankPasswordsToRandom().

102  {
103  static char charset[] =
104  "0123456789"
105  "abcdefghijklmnopqrstuvwxyz"
106  "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
107 
108  static std::mt19937 prng{std::random_device{}()};
109  static std::uniform_int_distribution<size_t> dist(0, strlen(charset) - 1);
110 
111  std::string str;
112  str.reserve(len);
113  for (size_t i = 0; i < len; i++) {
114  str += charset[dist(prng)];
115  }
116  return str;
117 }

+ Here is the caller graph for this function:

std::string hide_sensitive_data_from_query ( std::string const &  query_str)

Definition at line 66 of file StringTransform.cpp.

Referenced by query_state::StdLog::log().

66  {
67  constexpr std::regex::flag_type flags =
68  std::regex::ECMAScript | std::regex::icase | std::regex::optimize;
69  static const std::initializer_list<std::pair<std::regex, std::string>> rules{
70  {std::regex(R"(\b((?:password|s3_access_key|s3_secret_key)\s*=\s*)'.+?')", flags),
71  "$1'XXXXXXXX'"},
72  {std::regex(R"((\\set_license\s+)\S+)", flags), "$1XXXXXXXX"}};
73  return std::accumulate(
74  rules.begin(), rules.end(), query_str, [](auto& str, auto& rule) {
75  return std::regex_replace(str, rule.first, rule.second);
76  });
77 }

+ Here is the caller graph for this function:

ssize_t inside_string_literal ( const size_t  start,
const size_t  length,
const std::vector< std::pair< size_t, size_t >> &  literal_positions 
)

Definition at line 79 of file StringTransform.cpp.

Referenced by apply_shim().

82  {
83  const auto end = start + length;
84  for (const auto& literal_position : literal_positions) {
85  if (literal_position.first <= start && end <= literal_position.second) {
86  return literal_position.second;
87  }
88  }
89  return -1;
90 }

+ Here is the caller graph for this function:

template<typename T >
std::string join ( T const &  container,
std::string const &  delim 
)

Definition at line 64 of file StringTransform.h.

Referenced by ResultSetReductionJIT::cacheKey(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), concat_with(), DBHandler::connect_impl(), org.apache.calcite.sql2rel.SqlToRelConverter::convertFrom(), org.apache.calcite.sql2rel.SqlToRelConverter::convertMerge(), anonymous_namespace{RelLeftDeepInnerJoin.cpp}::create_left_deep_join(), DBHandler::create_table(), datum_to_string(), Catalog_Namespace::Catalog::dumpCreateTable(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), RelAlgExecutor::executeRelAlgQueryNoRetry(), ProxyTHttpClient::flush(), anonymous_namespace{SerializeToSql.cpp}::from_to_string(), generate_loop_ref::generate(), create_table.SyntheticTable::generateData(), anonymous_namespace{RelAlgExecutor.cpp}::get_data_sink(), anonymous_namespace{RelAlgOptimizer.cpp}::get_field_name(), anonymous_namespace{RelAlgExecutor.cpp}::get_join_source_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::get_join_type(), get_left_deep_join_root(), anonymous_namespace{RelAlgOptimizer.cpp}::get_live_ins(), run_benchmark::get_machine_info(), get_qualified_column_hints(), anonymous_namespace{RelAlgOptimizer.cpp}::get_visible_projects(), ExtensionFunctionsWhitelist::getLLVMDeclarations(), anonymous_namespace{SerializeToSql.cpp}::group_by_to_string(), hoist_filter_cond_to_cross_join(), QueryRunner::ImportDriver::importGeoTable(), anonymous_namespace{RelAlgDagBuilder.cpp}::isRenamedInput(), anonymous_namespace{SerializeToSql.cpp}::join_condition_to_string(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::onMatch(), org.apache.calcite.rel.rules.OuterJoinOptViaNullRejectionRule::onMatch(), operator<<(), org.apache.calcite.rel.rules.DynamicFilterJoinRule::performSelectivePushDown(), anonymous_namespace{RelAlgOptimizer.cpp}::pick_always_live_col_idx(), anonymous_namespace{RelAlgOptimizer.cpp}::propagate_input_renumbering(), anonymous_namespace{RelAlgOptimizer.cpp}::redirect_inputs_of(), QueryMemoryDescriptor::reductionKey(), org.apache.calcite.sql2rel.SqlToRelConverter.Blackboard::register(), TableArchiver::restoreTable(), com.mapd.calcite.parser.MapDParser::rewriteSimpleUpdateAsSelect(), logger::LogOptions::set_options(), sink_projected_boolean_expr_to_join(), org.apache.calcite.sql2rel.SqlToRelConverter::substituteSubQuery(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), anonymous_namespace{SerializeToSql.cpp}::targets_to_string(), org.apache.calcite.sql2rel.SqlToRelConverter::translateIn(), foreign_storage::ForeignServer::validate(), RelAlgVisitor< std::unordered_set< int > >::visit(), ScalarExprToSql::visitFunctionOper(), anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector::visitInput(), anonymous_namespace{RelAlgOptimizer.cpp}::RexInputCollector::visitInput(), anonymous_namespace{RelAlgOptimizer.cpp}::RexInputRedirector::visitInput(), ScalarExprToSql::visitInValues(), anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::visitNode(), ScalarExprToSql::visitWindowFunction(), anonymous_namespace{ExternalExecutor.cpp}::vt_create(), and anonymous_namespace{SerializeToSql.cpp}::where_to_string().

64  {
65  std::stringstream ss;
66  if (!container.empty()) {
67  ss << container.front();
68  for (auto itr = std::next(container.cbegin()); itr != container.cend(); ++itr) {
69  ss << delim << *itr;
70  }
71  }
72  return ss.str();
73 }
bool remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string ( std::string &  str)
noexcept

sanitize an SQL string

Definition at line 182 of file StringTransform.cpp.

183  {
184  char inside_quote = 0;
185  bool previous_c_was_backslash = false;
186  for (auto& c : str) {
187  // if this character is a quote of either type
188  if (c == '\'' || c == '\"') {
189  // ignore if previous character was a backslash
190  if (!previous_c_was_backslash) {
191  // start or end of a quoted region
192  if (inside_quote == c) {
193  // end region
194  inside_quote = 0;
195  } else if (inside_quote == 0) {
196  // start region
197  inside_quote = c;
198  }
199  }
200  } else if (inside_quote == 0) {
201  // outside quoted region
202  if (c == '\n' || c == '\t' || c == '\r') {
203  // replace these with space
204  c = ' ';
205  }
206  // otherwise leave alone, including quotes of a different type
207  }
208  // handle backslashes, except for double backslashes
209  if (c == '\\') {
210  previous_c_was_backslash = !previous_c_was_backslash;
211  } else {
212  previous_c_was_backslash = false;
213  }
214  }
215  // if we didn't end a region, there were unclosed or mixed-nested quotes
216  // accounting for backslashes should mean that this should only be the
217  // case with truly malformed strings which Calcite will barf on anyway
218  return (inside_quote == 0);
219 }
std::vector<std::string> split ( std::string_view  str,
std::string_view  delim = {},
std::optional< size_t >  maxsplit = std::nullopt 
)

split apart a string into a vector of substrings

Definition at line 123 of file StringTransform.cpp.

References run_benchmark_import::result.

Referenced by anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), create_table.SyntheticTable::createDataAndImportTable(), com.omnisci.jdbc.OmniSciStatement::executeQuery(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), get_qualified_column_hints(), TrackingProcessor::process(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), run_benchmark::read_query_files(), TableArchiver::restoreTable(), QueryRunner::QueryRunner::runMultipleStatements(), Parser::splitObjectHierName(), and com.mapd.parser.server.ExtensionFunctionSignatureParser::toSignature().

125  {
126  std::vector<std::string> result;
127 
128  // Use an explicit delimiter.
129  if (!delim.empty()) {
130  std::string::size_type i = 0, j = 0;
131  while ((i = str.find(delim, i)) != std::string::npos &&
132  (!maxsplit || result.size() < maxsplit.value())) {
133  result.emplace_back(str, j, i - j);
134  i += delim.size();
135  j = i;
136  }
137  result.emplace_back(str, j, std::string::npos);
138  return result;
139 
140  // Treat any number of consecutive whitespace characters as a delimiter.
141  } else {
142  bool prev_ws = true;
143  std::string::size_type i = 0, j = 0;
144  for (; i < str.size(); ++i) {
145  if (prev_ws) {
146  if (!isspace(str[i])) {
147  // start of word
148  prev_ws = false;
149  j = i;
150  }
151  } else {
152  if (isspace(str[i])) {
153  // start of space
154  result.emplace_back(str, j, i - j);
155  prev_ws = true;
156  j = i;
157  if ((maxsplit && result.size() == maxsplit.value())) {
158  // stop early if maxsplit was reached
159  result.emplace_back(str, j, std::string::npos);
160  return result;
161  }
162  }
163  }
164  }
165  if (!prev_ws) {
166  result.emplace_back(str, j, std::string::npos);
167  }
168  return result;
169  }
170 }

+ Here is the caller graph for this function:

std::string strip ( std::string_view  str)

trim any whitespace from the left and right ends of a string

Definition at line 172 of file StringTransform.cpp.

Referenced by Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), and QueryRunner::QueryRunner::runMultipleStatements().

172  {
173  std::string::size_type i, j;
174  for (i = 0; i < str.size() && std::isspace(str[i]); ++i) {
175  }
176  for (j = str.size(); j > i && std::isspace(str[j - 1]); --j) {
177  }
178  return std::string(str.substr(i, j - i));
179 }

+ Here is the caller graph for this function:

std::string to_lower ( const std::string &  str)
inline

Definition at line 100 of file StringTransform.h.

Referenced by TableFunctionCompilationContext::generateEntryPoint(), table_functions::TableFunctionsFactory::get(), lower_encoded(), Data_Namespace::ProcMeminfoParser::ProcMeminfoParser(), and anonymous_namespace{ExpressionRewrite.cpp}::ConstantFoldingVisitor::visitLower().

100  {
101  auto str_lc = str;
102  std::transform(str_lc.begin(), str_lc.end(), str_lc.begin(), ::tolower);
103  return str_lc;
104 }

+ Here is the caller graph for this function:

template<typename T >
std::string to_string ( T &&  v)

Definition at line 76 of file StringTransform.h.

76  {
77  std::ostringstream oss;
78  oss << v;
79  return oss.str();
80 }
template<>
std::string to_string ( char const *&&  v)

Definition at line 93 of file StringTransform.cpp.

Referenced by lockmgr::TableSchemaLockContainer< ReadLock >::acquireTableDescriptor(), lockmgr::TableSchemaLockContainer< WriteLock >::acquireTableDescriptor(), Importer_NS::TypedImportBuffer::add_value(), Catalog_Namespace::Catalog::addColumn(), Catalog_Namespace::Catalog::addFrontendViewToMapNoLock(), Catalog_Namespace::Catalog::addLinkToMap(), Catalog_Namespace::Catalog::addReferenceToForeignDict(), CgenState::addStringConstant(), anonymous_namespace{TableArchiver.cpp}::adjust_altered_table_files(), anonymous_namespace{TargetExprBuilder.cpp}::agg_fn_base_names(), Catalog_Namespace::SysCatalog::alterUser(), FixedLengthEncoder< T, V >::appendData(), query_state::StdLog::appendNameValuePairs(), Archive::archive_error(), Catalog_Namespace::Catalog::buildMaps(), Catalog_Namespace::SysCatalog::buildObjectDescriptorMap(), ResultSetReductionJIT::cacheKey(), Executor::castToFP(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), TargetExprCodegen::codegen(), anonymous_namespace{GpuSharedMemoryUtils.cpp}::codegen_smem_dest_slot_ptr(), GroupByAndAggregate::codegenAggColumnPtr(), CodeGenerator::codegenArrayAt(), CodeGenerator::codegenHoistedConstantsLoads(), CodeGenerator::codegenHoistedConstantsPlaceholders(), BaselineJoinHashTable::codegenMatchingSet(), GroupByAndAggregate::codegenOutputSlot(), BaselineJoinHashTable::codegenSlot(), CodeGenerator::codgenAdjustFixedEncNull(), CodeGenerator::colByteStream(), BloscCompressor::compress(), geospatial::compress_coords(), OverlapsJoinHashTable::computeBucketSizes(), DBHandler::convert_rows(), DBHandler::convert_target_metainfo(), File_Namespace::create(), DBHandler::create_dashboard(), create_dev_group_by_buffers(), DBHandler::create_table(), Catalog_Namespace::Catalog::createDashboard(), Catalog_Namespace::Catalog::createDashboardSystemRoles(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::Catalog::createForeignServerNoLocks(), Catalog_Namespace::Catalog::createLink(), Catalog_Namespace::Catalog::createTable(), RelAlgExecutor::createTableFunctionWorkUnit(), Catalog_Namespace::SysCatalog::createUser(), anonymous_namespace{ArrowImporter.h}::data_conversion_error(), datum_to_string(), DatumToString(), ArrowResultSet::deallocateArrowResultBuffer(), BloscCompressor::decompress(), Catalog_Namespace::Catalog::delDictionary(), DBHandler::delete_dashboard(), Catalog_Namespace::Catalog::deleteMetadataForDashboard(), Catalog_Namespace::SysCatalog::deleteObjectDescriptorMap(), Catalog_Namespace::deleteObjectPrivileges(), DecimalOverflowValidator::do_validate(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::SysCatalog::dropDatabase(), Catalog_Namespace::Catalog::dropForeignServer(), Catalog_Namespace::Catalog::dropTable(), Catalog_Namespace::SysCatalog::dropUser(), Catalog_Namespace::Catalog::dumpCreateTable(), Catalog_Namespace::Catalog::dumpSchema(), TableArchiver::dumpTable(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_write_projection(), anonymous_namespace{ArrowImporter.h}::error_context(), CudaMgr_Namespace::errorMessage(), Parser::CopyTableStmt::execute(), Parser::ExportQueryStmt::execute(), Catalog_Namespace::Catalog::executeDropTableSqliteQueries(), RelAlgExecutor::executeRelAlgQueryNoRetry(), RelAlgExecutor::executeSimpleInsert(), File_Namespace::FileMgr::FileMgr(), ProxyTHttpClient::flush(), Importer_NS::GDALErrorHandler(), anonymous_namespace{JoinLoopTest.cpp}::generate_descriptors(), Catalog_Namespace::Catalog::generatePhysicalTableName(), Geo_namespace::GeoPoint::GeoPoint(), anonymous_namespace{ArrowResultSetConverter.cpp}::get_arrow_type(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), DateTimeUtils::get_dateadd_high_precision_adjusted_scale(), DateTimeUtils::get_dateadd_timestamp_precision_scale(), DBHandler::get_db_object_privs(), DateTimeUtils::get_extract_timestamp_precision_scale(), Importer_NS::Detector::get_headers(), DBHandler::get_link_view(), TimeGM::get_overflow_underflow_safe_epoch(), ThriftClientConnection::get_protocol(), HitTestTypes::get_rowid_regex(), anonymous_namespace{Execute.cpp}::get_table_name(), DateTimeUtils::get_timestamp_precision_scale(), SQLTypeInfo::get_type_name(), DBHandler::get_valid_groups(), getArrowImportType(), Fragmenter_Namespace::InsertOrderFragmenter::getChunkMetadata(), Parser::LocalConnector::getColumnDescriptors(), getCurrentStackTrace(), CudaMgr_Namespace::CudaMgr::getDeviceProperties(), RelAlgExecutor::getErrorMessageFromCode(), Catalog_Namespace::Catalog::getForeignServersForUser(), Catalog_Namespace::SysCatalog::getGranteesOfSharedDashboards(), Catalog_Namespace::Catalog::getMetadataForDashboard(), Catalog_Namespace::SysCatalog::getMetadataForDBById(), Catalog_Namespace::SysCatalog::getMetadataForObject(), Catalog_Namespace::SysCatalog::getMetadataForUserById(), Catalog_Namespace::SysCatalog::getMetadataWithDefaultDB(), Catalog_Namespace::SysCatalog::getRoles(), DBHandler::has_object_privilege(), DBHandler::import_geo_table(), Importer_NS::import_thread_delimited(), Importer_NS::import_thread_shapefile(), File_Namespace::FileMgr::init(), anonymous_namespace{JoinHashTableInterface.cpp}::innerToString(), Catalog_Namespace::insertOrUpdateObjectPrivileges(), Executor::interrupt(), ResultSet::isGeoColOnGpu(), TableFunctionExecutionContext::launchCpuCode(), QueryExecutionContext::launchGpuCode(), DBHandler::load_table(), DBObject::loadKey(), anonymous_namespace{ExtensionFunctionsBinding.cpp}::match_arguments(), migrations::MigrationMgr::migrateDateInDaysMetadata(), Catalog_Namespace::SysCatalog::migrateDBAccessPrivileges(), numeric_type_name(), Importer_NS::ogr_to_type(), Geo_namespace::GeoTypesError::OGRErrorToStr(), File_Namespace::open(), anonymous_namespace{ArrowImporter.h}::ArrowValue< float >::operator const std::string(), anonymous_namespace{ArrowImporter.h}::ArrowValue< double >::operator const std::string(), anonymous_namespace{ArrowImporter.h}::ArrowValue< int64_t >::operator const std::string(), logger::JsonEncoder::operator()(), operator<<(), OutOfMemory::parse_error_str(), parse_numeric(), Importer_NS::delimited_parser::parse_string_array(), DBHandler::prepare_columnar_loader(), anonymous_namespace{geo_types.cpp}::process_poly_ring(), DictionaryValueConverter< TARGET_TYPE >::processBuffer(), query_template_impl(), Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions(), ResultSetReductionJIT::reduceOneEntryBaseline(), ResultSetReductionJIT::reduceOneEntryTargetsNoCollisions(), QueryMemoryDescriptor::reductionKey(), Executor::registerActiveModule(), BaselineJoinHashTable::reifyForDevice(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), File_Namespace::renameForDelete(), Catalog_Namespace::SysCatalog::renameObjectsInDescriptorMap(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::replaceDashboard(), TableArchiver::restoreTable(), ArrowResultSet::resultSetArrowLoopback(), Catalog_Namespace::SysCatalog::revokeAllOnDatabase_unsafe(), QueryRewriter::rewriteColumnarUpdate(), anonymous_namespace{TableArchiver.cpp}::run(), Executor::ExecutionDispatch::runImpl(), Importer_NS::RenderGroupAnalyzer::seedFromExistingTableContents(), serialize_column_ref(), serialize_table_ref(), Catalog_Namespace::Catalog::setColumnDictionary(), Catalog_Namespace::Catalog::setColumnSharedDictionary(), start_calcite_server_as_daemon(), query_state::StdLogData::StdLogData(), anonymous_namespace{StringTransform.h}::stringlike(), anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key(), DBHandler::thrift_to_copyparams(), logger::JsonEncoder::timer(), Parser::InSubquery::to_string(), Parser::InValues::to_string(), RexAbstractInput::toString(), ColSlotContext::toString(), JoinHashTableInterface::toString(), DBObject::toString(), Analyzer::ColumnVar::toString(), RexOperator::toString(), Analyzer::Var::toString(), RexSubQuery::toString(), QueryMemoryDescriptor::toString(), RexInput::toString(), Analyzer::UOper::toString(), SortField::toString(), RexRef::toString(), RexAgg::toString(), Analyzer::InIntegerSet::toString(), RelScan::toString(), RelProject::toString(), RelAggregate::toString(), RelJoin::toString(), RelFilter::toString(), Analyzer::LikelihoodExpr::toString(), RelLeftDeepInnerJoin::toString(), RelCompound::toString(), Analyzer::ExtractExpr::toString(), RelSort::toString(), Analyzer::DateaddExpr::toString(), Analyzer::DatediffExpr::toString(), Analyzer::DatetruncExpr::toString(), RelModify::toString(), Analyzer::OrderEntry::toString(), RelTableFunction::toString(), RelLogicalValues::toString(), anonymous_namespace{JoinHashTableInterface.cpp}::toStringFlat(), RelAlgTranslator::translateArrayFunction(), RelAlgTranslator::translateGeoFunctionArg(), RelAlgTranslator::translateHPTLiteral(), Executor::unregisterActiveModule(), Catalog_Namespace::SysCatalog::updateBlankPasswordsToRandom(), Fragmenter_Namespace::InsertOrderFragmenter::updateColumn(), Catalog_Namespace::Catalog::updateDeletedColumnIndicator(), Catalog_Namespace::Catalog::updateDictionaryNames(), Catalog_Namespace::Catalog::updateFixlenArrayColumns(), Catalog_Namespace::Catalog::updateGeoColumns(), Catalog_Namespace::Catalog::updateLogicalToPhysicalTableMap(), Catalog_Namespace::SysCatalog::updateObjectDescriptorMap(), Catalog_Namespace::Catalog::updatePageSize(), Catalog_Namespace::SysCatalog::updateSupportUserDeactivation(), Catalog_Namespace::Catalog::updateTableDescriptorSchema(), DateDaysOverflowValidator::validate(), MapDProgramOptions::validate(), foreign_storage::CsvDataWrapper::validateAndGetStringWithLength(), and ScalarExprToSql::visitUOper().

93  {
94  return std::string(v);
95 }
template<>
std::string to_string ( std::string &&  v)

Definition at line 98 of file StringTransform.cpp.

98  {
99  return std::move(v);
100 }
std::string to_upper ( const std::string &  str)
inline

Definition at line 94 of file StringTransform.h.

Referenced by Catalog_Namespace::Catalog::addColumn(), ExtensionFunctionsWhitelist::addCommon(), Catalog_Namespace::Catalog::addTableToMap(), Catalog_Namespace::Catalog::buildMaps(), Catalog_Namespace::SysCatalog::buildRoleMap(), Catalog_Namespace::SysCatalog::createDatabase(), Catalog_Namespace::SysCatalog::createRole_unsafe(), Catalog_Namespace::Catalog::dropColumn(), Catalog_Namespace::Catalog::dropFsiSchemasAndTables(), Catalog_Namespace::SysCatalog::dropRole_unsafe(), CreateForeignServerCommand::execute(), anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion(), ExtensionFunctionsWhitelist::get(), DBHandler::get_completion_hints(), ExtensionFunctionsWhitelist::get_ext_funcs(), DBHandler::get_uc_compatible_table_names_by_column(), ExtensionFunctionsWhitelist::get_udf(), Catalog_Namespace::Catalog::getDictionary(), Catalog_Namespace::SysCatalog::getGrantee(), just_whitelisted_keyword_hints(), parseStorageType(), foreign_storage::OptionsContainer::populateOptionsMap(), Catalog_Namespace::Catalog::removeTableFromMap(), Catalog_Namespace::Catalog::renameColumn(), Catalog_Namespace::SysCatalog::renameDatabase(), Catalog_Namespace::Catalog::renamePhysicalTable(), Catalog_Namespace::Catalog::roll(), should_suggest_column_hints(), StringToDatum(), Catalog_Namespace::SysCatalog::syncUserWithRemoteProvider(), and Catalog_Namespace::SysCatalog::updateUserRoleName().

94  {
95  auto str_uc = str;
96  std::transform(str_uc.begin(), str_uc.end(), str_uc.begin(), ::toupper);
97  return str_uc;
98 }

+ Here is the caller graph for this function:

bool unquote ( std::string &  )

Definition at line 221 of file StringTransform.cpp.

Referenced by logger::operator>>().

221  {
222  if (1 < str.size() && (str.front() == '\'' || str.front() == '"') &&
223  str.front() == str.back()) {
224  str.erase(str.size() - 1, 1);
225  str.erase(0, 1);
226  return true;
227  }
228  return false;
229 }

+ Here is the caller graph for this function: