OmniSciDB  72180abbfe
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StringTransform.cpp File Reference
#include "StringTransform.h"
#include <numeric>
#include <random>
#include <regex>
#include <boost/filesystem.hpp>
#include <iomanip>
+ Include dependency graph for StringTransform.cpp:

Go to the source code of this file.

Functions

void apply_shim (std::string &result, const boost::regex &reg_expr, const std::function< void(std::string &, const boost::smatch &)> &shim_fn)
 
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<>
std::string to_string (char const *&&v)
 
template<>
std::string to_string (std::string &&v)
 
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)
 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 &str)
 
std::string get_quoted_string (const std::string &filename, char quote, char escape)
 Quote a string while escaping any existing quotes in the string. More...
 
void filename_security_check (const std::string &filename)
 Throw exception if security problems found in a filename. More...
 

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 28 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().

30  {
31  boost::smatch what;
32  std::vector<std::pair<size_t, size_t>> lit_pos = find_string_literals(result);
33  auto start_it = result.cbegin();
34  auto end_it = result.cend();
35  while (true) {
36  if (!boost::regex_search(start_it, end_it, what, reg_expr)) {
37  break;
38  }
39  const auto next_start =
40  inside_string_literal(what.position(), what.length(), lit_pos);
41  if (next_start >= 0) {
42  start_it = result.cbegin() + next_start;
43  } else {
44  shim_fn(result, what);
45  lit_pos = find_string_literals(result);
46  start_it = result.cbegin();
47  end_it = result.cend();
48  }
49  }
50 }
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:

void filename_security_check ( const std::string &  filename)

Throw exception if security problems found in a filename.

Definition at line 243 of file StringTransform.cpp.

References error_code.

Referenced by TableArchiver::dumpTable(), TableArchiver::restoreTable(), and anonymous_namespace{TableArchiver.cpp}::simple_file_cat().

243  {
244  // We can always relax some of these rules later.
245 
246  // Canonicalize the filename, rejecting it if this basic step fails.
248  auto can = boost::filesystem::weakly_canonical(
249  filename, ec); // TODO: prevents string_view Jun 2020
250  if (ec) {
251  throw std::runtime_error("invalid filename: " + filename);
252  }
253 
254  // Reject any filenames containing whitespace for now.
255  for (const auto& ch : filename) {
256  if (std::isspace(ch)) {
257  throw std::runtime_error("invalid filename (whitespace): " + filename);
258  }
259  }
260 
261  // Reject any punctuation characters except for a few safe ones.
262  static const std::string safe_punctuation{"./_+-=:"};
263  for (const auto& ch : filename) {
264  if (std::ispunct(ch) && safe_punctuation.find(ch) == std::string::npos) {
265  throw std::runtime_error("invalid filename (punctuation): " + filename);
266  }
267  }
268 
269  // Reject any blacklisted filenames.
270  static const std::vector<std::string> blacklisted_filenames = {
271  "/etc/passwd", "/etc/passwd-", "/etc/shadow", "/etc/shadow-"};
272  if (std::find(blacklisted_filenames.begin(),
273  blacklisted_filenames.end(),
274  can.string()) != blacklisted_filenames.end()) {
275  throw std::runtime_error("invalid filename (blacklist): " + filename);
276  }
277 }
std::string filename(char const *path)
Definition: Logger.cpp:62
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t uint32_t const int64_t int32_t * error_code

+ Here is the caller graph for this function:

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

Definition at line 52 of file StringTransform.cpp.

References CHECK_GT.

Referenced by apply_shim().

52  {
53  boost::regex literal_string_regex{R"(([^']+)('(?:[^']+|'')+'))", boost::regex::perl};
54  boost::smatch what;
55  auto it = query.begin();
56  auto prev_it = it;
57  std::vector<std::pair<size_t, size_t>> positions;
58  while (true) {
59  if (!boost::regex_search(it, query.end(), what, literal_string_regex)) {
60  break;
61  }
62  CHECK_GT(what[1].length(), 0);
63  prev_it = it;
64  it += what.length();
65  positions.emplace_back(prev_it + what[1].length() - query.begin(),
66  it - query.begin());
67  }
68  return positions;
69 }
#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 107 of file StringTransform.cpp.

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

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

+ Here is the caller graph for this function:

std::string get_quoted_string ( const std::string &  filename,
char  quote,
char  escape 
)

Quote a string while escaping any existing quotes in the string.

Definition at line 237 of file StringTransform.cpp.

Referenced by TableArchiver::dumpTable(), TableArchiver::restoreTable(), and anonymous_namespace{TableArchiver.cpp}::simple_file_cat().

237  {
238  std::stringstream ss;
239  ss << std::quoted(filename, quote, escape); // TODO: prevents string_view Jun 2020
240  return ss.str();
241 }
std::string filename(char const *path)
Definition: Logger.cpp:62

+ Here is the caller graph for this function:

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

Definition at line 71 of file StringTransform.cpp.

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

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

+ 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 84 of file StringTransform.cpp.

Referenced by apply_shim().

87  {
88  const auto end = start + length;
89  for (const auto& literal_position : literal_positions) {
90  if (literal_position.first <= start && end <= literal_position.second) {
91  return literal_position.second;
92  }
93  }
94  return -1;
95 }

+ Here is the caller graph for this function:

bool remove_unquoted_newlines_linefeeds_and_tabs_from_sql_string ( std::string &  str)
noexcept

sanitize an SQL string

Definition at line 187 of file StringTransform.cpp.

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

split apart a string into a vector of substrings

Definition at line 128 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().

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

+ 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 177 of file StringTransform.cpp.

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

177  {
178  std::string::size_type i, j;
179  for (i = 0; i < str.size() && std::isspace(str[i]); ++i) {
180  }
181  for (j = str.size(); j > i && std::isspace(str[j - 1]); --j) {
182  }
183  return std::string(str.substr(i, j - i));
184 }

+ Here is the caller graph for this function:

template<>
std::string to_string ( char const *&&  v)

Definition at line 98 of file StringTransform.cpp.

Referenced by lockmgr::TableSchemaLockContainer< ReadLock >::acquireTableDescriptor(), lockmgr::TableSchemaLockContainer< WriteLock >::acquireTableDescriptor(), import_export::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(), query_state::StdLog::appendNameValuePairs(), Archive::archive_error(), import_export::QueryExporterGDAL::beginExport(), Catalog_Namespace::Catalog::buildMaps(), Catalog_Namespace::SysCatalog::buildObjectDescriptorMap(), ResultSetReductionJIT::cacheKey(), Executor::castToFP(), Catalog_Namespace::Catalog::changeForeignServerOwner(), anonymous_namespace{Execute.cpp}::checkWorkUnitWatchdog(), anonymous_namespace{GpuSharedMemoryUtils.cpp}::codegen_smem_dest_slot_ptr(), GroupByAndAggregate::codegenAggColumnPtr(), TargetExprCodegen::codegenAggregate(), 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(), FixedLengthEncoder< T, V >::encodeDataAndUpdateStats(), anonymous_namespace{ArrowImporter.h}::error_context(), CudaMgr_Namespace::errorMessage(), Parser::CopyTableStmt::execute(), Catalog_Namespace::Catalog::executeDropTableSqliteQueries(), RelAlgExecutor::executeRelAlgQueryNoRetry(), RelAlgExecutor::executeSimpleInsert(), File_Namespace::FileMgr::FileMgr(), ProxyTHttpClient::flush(), import_export::anonymous_namespace{GDAL.cpp}::gdal_error_handler(), 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(), import_export::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(), import_export::import_thread_delimited(), import_export::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(), import_export::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(), import_export::delimited_parser::parse_string_array(), DBHandler::prepare_columnar_loader(), foreign_storage::csv_file_buffer_parser::process_geo_column(), anonymous_namespace{geo_types.cpp}::process_poly_ring(), DictionaryValueConverter< TARGET_TYPE >::processBuffer(), query_template_impl(), ra_exec_unit_desc_for_caching(), 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(), import_export::QueryExporter::safeColumnName(), import_export::RenderGroupAnalyzer::seedFromExistingTableContents(), serialize_column_ref(), serialize_table_ref(), Catalog_Namespace::Catalog::setColumnDictionary(), Catalog_Namespace::Catalog::setColumnSharedDictionary(), Catalog_Namespace::Catalog::setForeignServerProperty(), Executor::skipFragment(), 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(), Analyzer::LikelihoodExpr::toString(), RelAggregate::toString(), RelJoin::toString(), Analyzer::ExtractExpr::toString(), RelFilter::toString(), Analyzer::DateaddExpr::toString(), RelLeftDeepInnerJoin::toString(), Analyzer::DatediffExpr::toString(), Analyzer::DatetruncExpr::toString(), RelCompound::toString(), Analyzer::OrderEntry::toString(), RelSort::toString(), RelModify::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(), CommandLineOptions::validate(), foreign_storage::ParquetDataWrapper::validateAndGetStringWithLength(), foreign_storage::CsvDataWrapper::validateAndGetStringWithLength(), and ScalarExprToSql::visitUOper().

98  {
99  return std::string(v);
100 }
template<>
std::string to_string ( std::string &&  v)

Definition at line 103 of file StringTransform.cpp.

103  {
104  return std::move(v);
105 }
bool unquote ( std::string &  str)

Definition at line 226 of file StringTransform.cpp.

Referenced by logger::operator>>().

226  {
227  if (1 < str.size() && (str.front() == '\'' || str.front() == '"') &&
228  str.front() == str.back()) {
229  str.erase(str.size() - 1, 1);
230  str.erase(0, 1);
231  return true;
232  }
233  return false;
234 }

+ Here is the caller graph for this function: