OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp} Namespace Reference

Functions

std::string append_file_path (const std::optional< std::string > &base, const std::optional< std::string > &subdirectory)
 
void throw_file_path_error (const std::string_view &missing_path, const std::string &table_name, const std::string_view &file_path_key)
 
std::optional< bool > get_file_roll_off_value (const ForeignTable *foreign_table)
 

Function Documentation

std::string foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp}::append_file_path ( const std::optional< std::string > &  base,
const std::optional< std::string > &  subdirectory 
)

Definition at line 92 of file AbstractFileStorageDataWrapper.cpp.

References generate_TableFunctionsFactory_init::separator.

Referenced by foreign_storage::AbstractFileStorageDataWrapper::getFullFilePath().

93  {
94 #ifdef _WIN32
95  const std::wstring str_to_cov{boost::filesystem::path::preferred_separator};
96  using convert_type = std::codecvt_utf8<wchar_t>;
97  std::wstring_convert<convert_type, wchar_t> converter;
98  std::string separator = converter.to_bytes(str_to_cov);
99 #else
100  const std::string separator{boost::filesystem::path::preferred_separator};
101 #endif
102  return std::regex_replace(
103  (base ? *base + separator : "") + (subdirectory ? *subdirectory : ""),
104  std::regex{separator + "{2,}"},
105  separator);
106 }

+ Here is the caller graph for this function:

std::optional<bool> foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp}::get_file_roll_off_value ( const ForeignTable *  foreign_table)

Definition at line 180 of file AbstractFileStorageDataWrapper.cpp.

References foreign_storage::AbstractFileStorageDataWrapper::ALLOW_FILE_ROLL_OFF_KEY, foreign_storage::OptionsContainer::getOption(), and to_upper().

Referenced by foreign_storage::AbstractFileStorageDataWrapper::allowFileRollOff(), and foreign_storage::AbstractFileStorageDataWrapper::validateFileRollOffOption().

180  {
181  auto option =
182  foreign_table->getOption(AbstractFileStorageDataWrapper::ALLOW_FILE_ROLL_OFF_KEY);
183  if (option.has_value()) {
184  if (to_upper(option.value()) == "TRUE") {
185  return true;
186  } else if (to_upper(option.value()) == "FALSE") {
187  return false;
188  } else {
189  return {};
190  }
191  }
192  return false;
193 }
std::string to_upper(const std::string &str)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::anonymous_namespace{AbstractFileStorageDataWrapper.cpp}::throw_file_path_error ( const std::string_view &  missing_path,
const std::string &  table_name,
const std::string_view &  file_path_key 
)

Definition at line 140 of file AbstractFileStorageDataWrapper.cpp.

Referenced by foreign_storage::AbstractFileStorageDataWrapper::validateFilePathOptionKey().

142  {
143  std::stringstream ss;
144  ss << "No file_path found for Foreign Table \"" << table_name
145  << "\". Table must have either set a \"" << file_path_key << "\" option, or its "
146  << "parent server must have set a \"" << missing_path << "\" option.";
147  throw std::runtime_error(ss.str());
148 }

+ Here is the caller graph for this function: