Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::DBConfig Struct Reference
Collaboration diagram for duckdb::DBConfig:

Public Member Functions

DUCKDB_API DBConfig (bool read_only)
DUCKDB_API DBConfig (const case_insensitive_map_t< Value > &config_dict, bool read_only)
DUCKDB_API void AddExtensionOption (const string &name, string description, LogicalType parameter, const Value &default_value=Value(), set_option_callback_t function=nullptr, SetScope default_scope=SetScope::SESSION)
DUCKDB_API bool HasExtensionOption (const string &name) const
DUCKDB_API case_insensitive_map_t< ExtensionOption > GetExtensionSettings () const
DUCKDB_API bool TryGetExtensionOption (const String &name, ExtensionOption &result) const
DUCKDB_API void SetOption (const ConfigurationOption &option, const Value &value)
DUCKDB_API void SetOption (optional_ptr< DatabaseInstance > db, const ConfigurationOption &option, const Value &value)
DUCKDB_API void SetOption (const string &name, Value value)
DUCKDB_API void SetOption (idx_t setting_index, Value value)
DUCKDB_API void SetOptionByName (const string &name, const Value &value)
DUCKDB_API void SetOptionsByName (const case_insensitive_map_t< Value > &values)
DUCKDB_API void ResetOption (optional_ptr< DatabaseInstance > db, const ConfigurationOption &option)
DUCKDB_API void ResetOption (const ExtensionOption &extension_option)
DUCKDB_API void ResetGenericOption (idx_t setting_index)
DUCKDB_API optional_idx TryGetSettingIndex (const String &name, optional_ptr< const ConfigurationOption > &option) const
DUCKDB_API void CheckLock (const String &name)
DUCKDB_API vector< reference< const CompressionFunction > > GetCompressionFunctions (const PhysicalType physical_type) const
 Returns the list of possible compression functions for the physical type.
DUCKDB_API reference< const CompressionFunction > GetCompressionFunction (CompressionType type, const PhysicalType physical_type) const
 Returns the compression function matching the compression and physical type. Throws an error if the function does not exist.
DUCKDB_API optional_ptr< const CompressionFunction > TryGetCompressionFunction (CompressionType type, const PhysicalType physical_type) const
DUCKDB_API void SetDisabledCompressionMethods (const vector< CompressionType > &disabled_compression_methods)
 Sets the disabled compression methods.
DUCKDB_API vector< CompressionType > GetDisabledCompressionMethods () const
 Returns a list of disabled compression methods.
DUCKDB_API optional_ptr< EncodingFunction > GetEncodeFunction (const string &name) const
 Returns the encode function matching the encoding name.
DUCKDB_API void RegisterEncodeFunction (const EncodingFunction &function) const
DUCKDB_API vector< reference< EncodingFunction > > GetLoadedEncodedFunctions () const
 Returns the encode function names.
DUCKDB_API ArrowTypeExtension GetArrowExtension (ArrowExtensionMetadata info) const
 Returns the encode function matching the encoding name.
DUCKDB_API ArrowTypeExtension GetArrowExtension (const LogicalType &type) const
DUCKDB_API bool HasArrowExtension (const LogicalType &type) const
DUCKDB_API bool HasArrowExtension (ArrowExtensionMetadata info) const
DUCKDB_API void RegisterArrowExtension (const ArrowTypeExtension &extension) const
bool operator== (const DBConfig &other)
bool operator!= (const DBConfig &other)
DUCKDB_API CastFunctionSet & GetCastFunctions ()
DUCKDB_API TypeManager & GetTypeManager ()
DUCKDB_API CollationBinding & GetCollationBinding ()
DUCKDB_API IndexTypeSet & GetIndexTypes ()
void SetDefaultMaxMemory ()
void SetDefaultTempDirectory ()
OrderType ResolveOrder (ClientContext &context, OrderType order_type) const
OrderByNullType ResolveNullOrder (ClientContext &context, OrderType order_type, OrderByNullType null_type) const
const string UserAgent () const
SettingLookupResult TryGetCurrentSetting (const string &key, Value &result) const
 Returns the value of a setting currently. If the setting is not set by the user, returns the default value.
SettingLookupResult TryGetCurrentUserSetting (idx_t setting_index, Value &result) const
 Returns the value of a setting set by the user currently.
bool CanAccessFile (const string &path, FileType type)
void AddAllowedConfig (const string &config_name)
void AddAllowedDirectory (const string &path)
void AddAllowedPath (const string &path)
string SanitizeAllowedPath (const string &path) const
ExtensionCallbackManager & GetCallbackManager ()
const ExtensionCallbackManager & GetCallbackManager () const
void SetHTTPUtil (const shared_ptr< HTTPUtil > &new_http_util)
HTTPUtil & GetHTTPUtil () const

Static Public Member Functions

static DUCKDB_API DBConfig & GetConfig (ClientContext &context)
static DUCKDB_API DBConfig & GetConfig (DatabaseInstance &db)
static DUCKDB_API DBConfig & Get (AttachedDatabase &db)
static DUCKDB_API const DBConfig & GetConfig (const ClientContext &context)
static DUCKDB_API const DBConfig & GetConfig (const DatabaseInstance &db)
static DUCKDB_API vector< ConfigurationOption > GetOptions ()
static DUCKDB_API vector< ConfigurationAlias > GetAliases ()
static DUCKDB_API idx_t GetOptionCount ()
static DUCKDB_API idx_t GetAliasCount ()
static DUCKDB_API vector< string > GetOptionNames ()
static DUCKDB_API bool IsInMemoryDatabase (const char *database_path)
static DUCKDB_API optional_ptr< const ConfigurationOption > GetOptionByIndex (idx_t index)
 Fetch an option by index. Returns a pointer to the option, or nullptr if out of range.
static DUCKDB_API optional_ptr< const ConfigurationAlias > GetAliasByIndex (idx_t index)
 Fetcha n alias by index, or nullptr if out of range.
static DUCKDB_API optional_ptr< const ConfigurationOption > GetOptionByName (const String &name)
 Fetch an option by name. Returns a pointer to the option, or nullptr if none exists.
static LogicalType ParseLogicalType (const string &type)
static DUCKDB_API idx_t ParseMemoryLimit (const string &arg)
static idx_t GetSystemMaxThreads (FileSystem &fs)
static idx_t GetSystemAvailableMemory (FileSystem &fs)
static optional_idx ParseMemoryLimitSlurm (const string &arg)
static SettingLookupResult TryGetDefaultValue (optional_ptr< const ConfigurationOption > option, Value &result)
 Returns the default value of an option.

Public Attributes

vector< ReplacementScan > replacement_scans
 Replacement table scans are automatically attempted when a table name cannot be found in the schema.
unique_ptr< FileSystem > file_system
 The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g. RamFS or something similar).
unique_ptr< SecretManager > secret_manager
 Secret manager.
unique_ptr< Allocator > allocator
 The allocator used by the system.
unique_ptr< BlockAllocator > block_allocator
 The block allocator used by the system.
DBConfigOptions options
 Database configuration options.
unique_ptr< ErrorManager > error_manager
 Error manager.
shared_ptr< Allocator > default_allocator
 A reference to the (shared) default allocator (Allocator::DefaultAllocator).
shared_ptr< BufferPool > buffer_pool
 A buffer pool can be shared across multiple databases (if desired).
shared_ptr< BufferManager > buffer_manager
 Provide a custom buffer manager implementation (if desired).
shared_ptr< EncryptionUtil > encryption_util
 Encryption Util for OpenSSL and MbedTLS.
shared_ptr< DatabaseCacheEntry > db_cache_entry
 Reference to the database cache entry (if any).
shared_ptr< DatabaseFilePathManager > path_manager
 Reference to the database file path manager.
GlobalUserSettings user_settings
 Database configuration variables as controlled by SET.

Private Attributes

mutex config_lock
unique_ptr< CompressionFunctionSet > compression_functions
unique_ptr< EncodingFunctionSet > encoding_functions
unique_ptr< ArrowTypeExtensionSet > arrow_extensions
unique_ptr< TypeManager > type_manager
unique_ptr< CollationBinding > collation_bindings
unique_ptr< IndexTypeSet > index_types
unique_ptr< ExtensionCallbackManager > callback_manager
bool is_user_config = true
shared_ptr< HTTPUtil > http_util
 HTTP Request utility functions.
vector< shared_ptr< HTTPUtil > > old_http_utils
mutex http_util_lock

Friends

class DatabaseInstance
class StorageManager

Constructor & Destructor Documentation

◆ DBConfig() [1/3]

duckdb::DBConfig::DBConfig ( )
276780 {
276781 compression_functions = make_uniq<CompressionFunctionSet>();
276782 encoding_functions = make_uniq<EncodingFunctionSet>();
276783 encoding_functions->Initialize(*this);
276784 arrow_extensions = make_uniq<ArrowTypeExtensionSet>();
276785 arrow_extensions->Initialize(*this);
276786 type_manager = make_uniq<TypeManager>(*this);
276787 collation_bindings = make_uniq<CollationBinding>();
276788 index_types = make_uniq<IndexTypeSet>();
276789 error_manager = make_uniq<ErrorManager>();
276790 secret_manager = make_uniq<SecretManager>();
276791 http_util = make_shared_ptr<HTTPUtil>();
276792 callback_manager = make_uniq<ExtensionCallbackManager>();
276793}
shared_ptr< HTTPUtil > http_util
HTTP Request utility functions.
Definition duckdb.hpp:40221
unique_ptr< SecretManager > secret_manager
Secret manager.
Definition duckdb.hpp:40084
unique_ptr< ErrorManager > error_manager
Error manager.
Definition duckdb.hpp:40092

◆ DBConfig() [2/3]

duckdb::DBConfig::DBConfig ( bool read_only)
explicit
276795 : DBConfig::DBConfig() {
276796 if (read_only) {
276797 options.access_mode = AccessMode::READ_ONLY;
276798 }
276799}
DBConfigOptions options
Database configuration options.
Definition duckdb.hpp:40090

◆ DBConfig() [3/3]

duckdb::DBConfig::DBConfig ( const case_insensitive_map_t< Value > & config_dict,
bool read_only )
276801 : DBConfig::DBConfig(read_only) {
276802 SetOptionsByName(config_dict);
276803}

◆ ~DBConfig()

duckdb::DBConfig::~DBConfig ( )
276805 {
276806}

Member Function Documentation

◆ GetConfig() [1/4]

DBConfig & duckdb::DBConfig::GetConfig ( ClientContext & context)
static
277234 {
277235 return context.db->config;
277236}

◆ GetConfig() [2/4]

DBConfig & duckdb::DBConfig::GetConfig ( DatabaseInstance & db)
static
276870 {
276871 return db.config;
276872}
db

◆ Get()

DBConfig & duckdb::DBConfig::Get ( AttachedDatabase & db)
static
276878 {
276879 return DBConfig::GetConfig(db.GetDatabase());
276880}

◆ GetConfig() [3/4]

const DBConfig & duckdb::DBConfig::GetConfig ( const ClientContext & context)
static
277238 {
277239 return context.db->config;
277240}

◆ GetConfig() [4/4]

const DBConfig & duckdb::DBConfig::GetConfig ( const DatabaseInstance & db)
static
276882 {
276883 return db.config;
276884}

◆ GetOptions()

vector< ConfigurationOption > duckdb::DBConfig::GetOptions ( )
static
274756 {
274757 vector<ConfigurationOption> options;
274758 for (idx_t index = 0; internal_options[index].name; index++) {
274759 options.push_back(internal_options[index]);
274760 }
274761 return options;
274762}
index
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GetAliases()

vector< ConfigurationAlias > duckdb::DBConfig::GetAliases ( )
static
274764 {
274765 vector<ConfigurationAlias> aliases;
274766 for (idx_t index = 0; index < GetAliasCount(); index++) {
274767 aliases.push_back(setting_aliases[index]);
274768 }
274769 return aliases;
274770}

◆ GetOptionCount()

idx_t duckdb::DBConfig::GetOptionCount ( )
static
274780 {
274781 return sizeof(internal_options) / sizeof(ConfigurationOption) - 1;
274782}

◆ GetAliasCount()

idx_t duckdb::DBConfig::GetAliasCount ( )
static
274784 {
274785 return sizeof(setting_aliases) / sizeof(ConfigurationAlias) - 1;
274786}

◆ GetOptionNames()

vector< string > duckdb::DBConfig::GetOptionNames ( )
static
274788 {
274789 vector<string> names;
274790 for (idx_t index = 0; internal_options[index].name; index++) {
274791 names.emplace_back(internal_options[index].name);
274792 }
274793 for (idx_t index = 0; setting_aliases[index].alias; index++) {
274794 names.emplace_back(setting_aliases[index].alias);
274795 }
274796 return names;
274797}

◆ IsInMemoryDatabase()

bool duckdb::DBConfig::IsInMemoryDatabase ( const char * database_path)
static
275043 {
275044 if (!database_path) {
275045 // Entirely empty
275046 return true;
275047 }
275048 if (strlen(database_path) == 0) {
275049 // '' empty string
275050 return true;
275051 }
275052 if (strcmp(database_path, ":memory:") == 0) {
275053 return true;
275054 }
275055 return false;
275056}

◆ AddExtensionOption()

void duckdb::DBConfig::AddExtensionOption ( const string & name,
string description,
LogicalType parameter,
const Value & default_value = Value(),
set_option_callback_t function = nullptr,
SetScope default_scope = SetScope::SESSION )
275023 {
275024 ExtensionOption extension_option(std::move(description), std::move(parameter), function, default_value,
275025 default_scope);
275026 auto setting_index = user_settings.AddExtensionOption(name, std::move(extension_option));
275027 // copy over unrecognized options, if they match the new extension option
275028 auto iter = options.unrecognized_options.find(name);
275029 if (iter != options.unrecognized_options.end()) {
275030 user_settings.SetUserSetting(setting_index, iter->second);
275031 options.unrecognized_options.erase(iter);
275032 }
275033 if (!default_value.IsNull() && !user_settings.IsSet(setting_index)) {
275034 // Default value is set, insert it into the 'set_variables' list
275035 user_settings.SetUserSetting(setting_index, default_value);
275036 }
275037}
GlobalUserSettings user_settings
Database configuration variables as controlled by SET.
Definition duckdb.hpp:40106

◆ HasExtensionOption()

bool duckdb::DBConfig::HasExtensionOption ( const string & name) const
275014 {
275015 return user_settings.HasExtensionOption(name);
275016}

◆ GetExtensionSettings()

case_insensitive_map_t< ExtensionOption > duckdb::DBConfig::GetExtensionSettings ( ) const
275039 {
275040 return user_settings.GetExtensionSettings();
275041}

◆ TryGetExtensionOption()

bool duckdb::DBConfig::TryGetExtensionOption ( const String & name,
ExtensionOption & result ) const
275018 {
275019 return user_settings.TryGetExtensionOption(name, result);
275020}

◆ GetOptionByIndex()

optional_ptr< const ConfigurationOption > duckdb::DBConfig::GetOptionByIndex ( idx_t index)
static

Fetch an option by index. Returns a pointer to the option, or nullptr if out of range.

274799 {
274800 if (target_index >= GetOptionCount()) {
274801 return nullptr;
274802 }
274803 return internal_options + target_index;
274804}
Here is the caller graph for this function:

◆ GetAliasByIndex()

optional_ptr< const ConfigurationAlias > duckdb::DBConfig::GetAliasByIndex ( idx_t index)
static

Fetcha n alias by index, or nullptr if out of range.

274806 {
274807 if (target_index >= GetAliasCount()) {
274808 return nullptr;
274809 }
274810 return setting_aliases + target_index;
274811}

◆ GetOptionByName()

optional_ptr< const ConfigurationOption > duckdb::DBConfig::GetOptionByName ( const String & name)
static

Fetch an option by name. Returns a pointer to the option, or nullptr if none exists.

274813 {
274814 auto lname = name.Lower();
274815 for (idx_t index = 0; internal_options[index].name; index++) {
274816 D_ASSERT(StringUtil::Lower(internal_options[index].name) == string(internal_options[index].name));
274817 if (internal_options[index].name == lname) {
274818 return internal_options + index;
274819 }
274820 }
274821 for (idx_t index = 0; setting_aliases[index].alias; index++) {
274822 D_ASSERT(StringUtil::Lower(internal_options[index].name) == string(internal_options[index].name));
274823 if (setting_aliases[index].alias == lname) {
274824 return GetOptionByIndex(setting_aliases[index].option_index);
274825 }
274826 }
274827 return nullptr;
274828}
static DUCKDB_API string Lower(const string &str)
Convert a string to lowercase.
Definition duckdb.cpp:109630
static DUCKDB_API optional_ptr< const ConfigurationOption > GetOptionByIndex(idx_t index)
Fetch an option by index. Returns a pointer to the option, or nullptr if out of range.
Definition duckdb.cpp:274799
Here is the call graph for this function:

◆ SetOption() [1/4]

void duckdb::DBConfig::SetOption ( const ConfigurationOption & option,
const Value & value )
274830 {
274831 SetOption(nullptr, option, value);
274832}

◆ SetOption() [2/4]

void duckdb::DBConfig::SetOption ( optional_ptr< DatabaseInstance > db,
const ConfigurationOption & option,
const Value & value )
274862 {
274863 Value input = value.DefaultCastAs(ParseLogicalType(option.parameter_type));
274864 if (option.default_value) {
274865 // generic option
274866 if (option.set_callback) {
274867 SettingCallbackInfo info(*this, db);
274868 option.set_callback(info, input);
274869 }
274870 user_settings.SetUserSetting(option.setting_idx.GetIndex(), std::move(input));
274871 return;
274872 }
274873 if (!option.set_global) {
274874 throw InvalidInputException("Could not set option \"%s\" as a global option", option.name);
274875 }
274876 lock_guard<mutex> guard(config_lock);
274877 D_ASSERT(option.reset_global);
274878 option.set_global(db.get(), *this, input);
274879}

◆ SetOption() [3/4]

void duckdb::DBConfig::SetOption ( const string & name,
Value value )
274899 {
274900 optional_ptr<const ConfigurationOption> option;
274901 auto setting_index = TryGetSettingIndex(name, option);
274902 if (!setting_index.IsValid()) {
274903 throw InternalException("Unrecognized option %s in DBConfig::SetOption", name);
274904 }
274905 SetOption(setting_index.GetIndex(), std::move(value));
274906}

◆ SetOption() [4/4]

void duckdb::DBConfig::SetOption ( idx_t setting_index,
Value value )
274895 {
274896 user_settings.SetUserSetting(setting_index, std::move(value));
274897}

◆ SetOptionByName()

void duckdb::DBConfig::SetOptionByName ( const string & name,
const Value & value )
274834 {
274835 if (is_user_config) {
274836 // for user config we just set the option in the `user_options`
274837 options.user_options[name] = value;
274838 }
274839 auto option = DBConfig::GetOptionByName(name);
274840 if (option) {
274841 SetOption(*option, value);
274842 return;
274843 }
274844
274845 ExtensionOption extension_option;
274846 if (TryGetExtensionOption(name, extension_option)) {
274847 Value target_value = value.DefaultCastAs(extension_option.type);
274848 SetOption(extension_option.setting_index.GetIndex(), std::move(target_value));
274849 } else {
274850 options.unrecognized_options[name] = value;
274851 }
274852}
static DUCKDB_API optional_ptr< const ConfigurationOption > GetOptionByName(const String &name)
Fetch an option by name. Returns a pointer to the option, or nullptr if none exists.
Definition duckdb.cpp:274813

◆ SetOptionsByName()

void duckdb::DBConfig::SetOptionsByName ( const case_insensitive_map_t< Value > & values)
274854 {
274855 for (auto &kv : values) {
274856 auto &name = kv.first;
274857 auto &value = kv.second;
274858 SetOptionByName(name, value);
274859 }
274860}

◆ ResetOption() [1/2]

void duckdb::DBConfig::ResetOption ( optional_ptr< DatabaseInstance > db,
const ConfigurationOption & option )
274881 {
274882 if (option.default_value) {
274883 // generic option
274884 user_settings.ClearSetting(option.setting_idx.GetIndex());
274885 return;
274886 }
274887 if (!option.reset_global) {
274888 throw InternalException("Could not reset option \"%s\" as a global option", option.name);
274889 }
274890 lock_guard<mutex> guard(config_lock);
274891 D_ASSERT(option.set_global);
274892 option.reset_global(db.get(), *this);
274893}

◆ ResetOption() [2/2]

void duckdb::DBConfig::ResetOption ( const ExtensionOption & extension_option)
274908 {
274909 auto &default_value = extension_option.default_value;
274910 auto setting_index = extension_option.setting_index.GetIndex();
274911 if (!default_value.IsNull()) {
274912 // Default is not NULL, override the setting
274913 user_settings.SetUserSetting(setting_index, default_value);
274914 } else {
274915 // Otherwise just remove it from the 'set_variables' map
274916 user_settings.ClearSetting(setting_index);
274917 }
274918}

◆ ResetGenericOption()

void duckdb::DBConfig::ResetGenericOption ( idx_t setting_index)
274920 {
274921 user_settings.ClearSetting(setting_index);
274922}

◆ TryGetSettingIndex()

optional_idx duckdb::DBConfig::TryGetSettingIndex ( const String & name,
optional_ptr< const ConfigurationOption > & option ) const
275274 {
275275 ExtensionOption extension_option;
275276 if (TryGetExtensionOption(name, extension_option)) {
275277 // extension setting
275278 return extension_option.setting_index;
275279 }
275280 option = GetOptionByName(name);
275281 if (option) {
275282 // built-in setting
275283 return option->setting_idx;
275284 }
275285 // unknown setting
275286 return optional_idx();
275287}

◆ ParseLogicalType()

LogicalType duckdb::DBConfig::ParseLogicalType ( const string & type)
static
274924 {
274925 if (StringUtil::EndsWith(type, "[]")) {
274926 // list - recurse
274927 auto child_type = ParseLogicalType(type.substr(0, type.size() - 2));
274928 return LogicalType::LIST(child_type);
274929 }
274930
274931 if (StringUtil::EndsWith(type, "]")) {
274932 // array - recurse
274933 auto bracket_open_idx = type.rfind('[');
274934 if (bracket_open_idx == string::npos || bracket_open_idx == 0) {
274935 throw InternalException("Ill formatted type: '%s'", type);
274936 }
274937 idx_t array_size = 0;
274938 for (auto length_idx = bracket_open_idx + 1; length_idx < type.size() - 1; length_idx++) {
274939 if (!isdigit(type[length_idx])) {
274940 throw InternalException("Ill formatted array type: '%s'", type);
274941 }
274942 array_size = array_size * 10 + static_cast<idx_t>(type[length_idx] - '0');
274943 }
274944 if (array_size == 0 || array_size > ArrayType::MAX_ARRAY_SIZE) {
274945 throw InternalException("Invalid array size: '%s'", type);
274946 }
274947 auto child_type = ParseLogicalType(type.substr(0, bracket_open_idx));
274948 return LogicalType::ARRAY(child_type, array_size);
274949 }
274950
274951 if (StringUtil::StartsWith(type, "MAP(") && StringUtil::EndsWith(type, ")")) {
274952 // map - recurse
274953 string map_args = type.substr(4, type.size() - 5);
274954 vector<string> map_args_vect = StringUtil::SplitWithParentheses(map_args);
274955 if (map_args_vect.size() != 2) {
274956 throw InternalException("Ill formatted map type: '%s'", type);
274957 }
274958 StringUtil::Trim(map_args_vect[0]);
274959 StringUtil::Trim(map_args_vect[1]);
274960 auto key_type = ParseLogicalType(map_args_vect[0]);
274961 auto value_type = ParseLogicalType(map_args_vect[1]);
274962 return LogicalType::MAP(key_type, value_type);
274963 }
274964
274965 if (StringUtil::StartsWith(type, "UNION(") && StringUtil::EndsWith(type, ")")) {
274966 // union - recurse
274967 string union_members_str = type.substr(6, type.size() - 7);
274968 vector<string> union_members_vect = StringUtil::SplitWithParentheses(union_members_str);
274969 child_list_t<LogicalType> union_members;
274970 for (idx_t member_idx = 0; member_idx < union_members_vect.size(); member_idx++) {
274971 StringUtil::Trim(union_members_vect[member_idx]);
274972 vector<string> union_member_parts = StringUtil::SplitWithParentheses(union_members_vect[member_idx], ' ');
274973 if (union_member_parts.size() != 2) {
274974 throw InternalException("Ill formatted union type: %s", type);
274975 }
274976 StringUtil::Trim(union_member_parts[0]);
274977 StringUtil::Trim(union_member_parts[1]);
274978 auto value_type = ParseLogicalType(union_member_parts[1]);
274979 union_members.emplace_back(make_pair(union_member_parts[0], value_type));
274980 }
274981 if (union_members.empty() || union_members.size() > UnionType::MAX_UNION_MEMBERS) {
274982 throw InternalException("Invalid number of union members: '%s'", type);
274983 }
274984 return LogicalType::UNION(union_members);
274985 }
274986
274987 if (StringUtil::StartsWith(type, "STRUCT(") && StringUtil::EndsWith(type, ")")) {
274988 // struct - recurse
274989 string struct_members_str = type.substr(7, type.size() - 8);
274990 vector<string> struct_members_vect = StringUtil::SplitWithParentheses(struct_members_str);
274991 child_list_t<LogicalType> struct_members;
274992 for (idx_t member_idx = 0; member_idx < struct_members_vect.size(); member_idx++) {
274993 StringUtil::Trim(struct_members_vect[member_idx]);
274994 vector<string> struct_member_parts = StringUtil::SplitWithParentheses(struct_members_vect[member_idx], ' ');
274995 if (struct_member_parts.size() != 2) {
274996 throw InternalException("Ill formatted struct type: %s", type);
274997 }
274998 StringUtil::Trim(struct_member_parts[0]);
274999 StringUtil::Trim(struct_member_parts[1]);
275000 auto value_type = ParseLogicalType(struct_member_parts[1]);
275001 struct_members.emplace_back(make_pair(struct_member_parts[0], value_type));
275002 }
275003 return LogicalType::STRUCT(struct_members);
275004 }
275005
275006 const auto type_id = StringUtil::CIEquals(type, "ANY") ? LogicalTypeId::ANY : TransformStringToLogicalTypeId(type);
275007 if (type_id == LogicalTypeId::UNBOUND) {
275008 throw InternalException("Error while generating extension function overloads - unrecognized logical type %s",
275009 type);
275010 }
275011 return type_id;
275012}
static DUCKDB_API void Trim(string &str)
Remove the whitespace char in the left and right end of the string.
Definition duckdb.cpp:109372
static DUCKDB_API bool CIEquals(const string &l1, const string &l2)
Case insensitive equals.
Definition duckdb.cpp:109696
static DUCKDB_API vector< string > SplitWithParentheses(const string &str, char delimiter=',', char par_open='(', char par_close=')')
Split the input string, ignore delimiters within parentheses. Note: leading/trailing spaces are NOT s...
Definition duckdb.cpp:109460
static DUCKDB_API bool StartsWith(string str, string prefix)
Returns true if the target string starts with the given prefix.
Definition duckdb.cpp:109377
static DUCKDB_API bool EndsWith(const string &str, const string &suffix)
Returns true if the target string ends with the given suffix.
Definition duckdb.cpp:109384
R value_type

◆ CheckLock()

void duckdb::DBConfig::CheckLock ( const String & name)
275095 {
275096 if (!Settings::Get<LockConfigurationSetting>(*this)) {
275097 // not locked
275098 return;
275099 }
275100 case_insensitive_set_t allowed_settings {"schema", "search_path"};
275101 if (allowed_settings.find(name.ToStdString()) != allowed_settings.end()) {
275102 // we are always allowed to change these settings
275103 return;
275104 }
275105 if (!options.allowed_configs.empty()) {
275106 auto option = GetOptionByName(name);
275107 auto canonical_name = option ? string(option->name) : name.ToStdString();
275108 if (options.allowed_configs.find(canonical_name) != options.allowed_configs.end()) {
275109 // settings that are allowed through allowed_configs
275110 return;
275111 }
275112 }
275113 // not allowed!
275114 throw InvalidInputException("Cannot change configuration option \"%s\" - the configuration has been locked", name);
275115}

◆ ParseMemoryLimit()

idx_t duckdb::DBConfig::ParseMemoryLimit ( const string & arg)
static
275170 {
275171 if (arg[0] == '-' || arg == "null" || arg == "none") {
275172 // infinite
275173 return NumericLimits<idx_t>::Maximum();
275174 }
275175
275176 idx_t result;
275177 string error = StringUtil::TryParseFormattedBytes(arg, result);
275178
275179 if (!error.empty()) {
275180 if (error == "Memory cannot be negative") {
275181 result = DConstants::INVALID_INDEX;
275182 } else {
275183 throw ParserException(error);
275184 }
275185 }
275186
275187 return result;
275188}
internal::named_arg< T, Char > arg(const S &name, const T &arg)
Definition duckdb.cpp:16242
static constexpr const idx_t INVALID_INDEX
The value used to signify an invalid index entry.
Definition duckdb.hpp:1117

◆ GetCompressionFunctions()

vector< reference< const CompressionFunction > > duckdb::DBConfig::GetCompressionFunctions ( const PhysicalType physical_type) const

Returns the list of possible compression functions for the physical type.

220401 {
220402 return compression_functions->GetCompressionFunctions(physical_type);
220403}

◆ GetCompressionFunction()

reference< const CompressionFunction > duckdb::DBConfig::GetCompressionFunction ( CompressionType type,
const PhysicalType physical_type ) const

Returns the compression function matching the compression and physical type. Throws an error if the function does not exist.

220411 {
220412 auto result = compression_functions->GetCompressionFunction(type, physical_type);
220413 if (!result) {
220414 throw InternalException(
220415 "Could not find compression function \"%s\" for physical type \"%s\". Load result: %s. %s",
220416 EnumUtil::ToString(type), EnumUtil::ToString(physical_type));
220417 }
220418 return *result;
220419}
Here is the caller graph for this function:

◆ TryGetCompressionFunction()

optional_ptr< const CompressionFunction > duckdb::DBConfig::TryGetCompressionFunction ( CompressionType type,
const PhysicalType physical_type ) const
220406 {
220407 return compression_functions->GetCompressionFunction(type, physical_type);
220408}

◆ SetDisabledCompressionMethods()

void duckdb::DBConfig::SetDisabledCompressionMethods ( const vector< CompressionType > & disabled_compression_methods)

Sets the disabled compression methods.

220377 {
220378 compression_functions->SetDisabledCompressionMethods(methods);
220379}

◆ GetDisabledCompressionMethods()

vector< CompressionType > duckdb::DBConfig::GetDisabledCompressionMethods ( ) const

Returns a list of disabled compression methods.

220391 {
220392 return compression_functions->GetDisabledCompressionMethods();
220393}

◆ GetEncodeFunction()

optional_ptr< EncodingFunction > duckdb::DBConfig::GetEncodeFunction ( const string & name) const

Returns the encode function matching the encoding name.

220755 {
220756 lock_guard<mutex> l(encoding_functions->lock);
220757 // Check if the function is already loaded into the global compression functions.
220758 if (encoding_functions->functions.find(name) != encoding_functions->functions.end()) {
220759 return &encoding_functions->functions[name];
220760 }
220761 return nullptr;
220762}

◆ RegisterEncodeFunction()

void duckdb::DBConfig::RegisterEncodeFunction ( const EncodingFunction & function) const
220746 {
220747 lock_guard<mutex> l(encoding_functions->lock);
220748 const auto name = function.GetName();
220749 if (encoding_functions->functions.find(name) != encoding_functions->functions.end()) {
220750 throw InvalidInputException("Decoding function with name %s already registered", name);
220751 }
220752 encoding_functions->functions[name] = function;
220753}

◆ GetLoadedEncodedFunctions()

vector< reference< EncodingFunction > > duckdb::DBConfig::GetLoadedEncodedFunctions ( ) const

Returns the encode function names.

220764 {
220765 lock_guard<mutex> l(encoding_functions->lock);
220766 vector<reference<EncodingFunction>> result;
220767 for (auto &function : encoding_functions->functions) {
220768 result.push_back(function.second);
220769 }
220770 return result;
220771}

◆ GetArrowExtension() [1/2]

ArrowTypeExtension duckdb::DBConfig::GetArrowExtension ( ArrowExtensionMetadata info) const

Returns the encode function matching the encoding name.

45184 {
45185 lock_guard<mutex> l(arrow_extensions->lock);
45186 return GetArrowExtensionInternal(arrow_extensions->type_extensions, std::move(info));
45187}

◆ GetArrowExtension() [2/2]

ArrowTypeExtension duckdb::DBConfig::GetArrowExtension ( const LogicalType & type) const
45189 {
45190 lock_guard<mutex> l(arrow_extensions->lock);
45191 TypeInfo type_info(type);
45192 if (!arrow_extensions->type_to_info[type_info].empty()) {
45193 return GetArrowExtensionInternal(arrow_extensions->type_extensions,
45194 arrow_extensions->type_to_info[type_info].front());
45195 }
45196 type_info.type = LogicalTypeId::ANY;
45197 return GetArrowExtensionInternal(arrow_extensions->type_extensions,
45198 arrow_extensions->type_to_info[type_info].front());
45199}

◆ HasArrowExtension() [1/2]

bool duckdb::DBConfig::HasArrowExtension ( const LogicalType & type) const
45201 {
45202 lock_guard<mutex> l(arrow_extensions->lock);
45203 TypeInfo type_info(type);
45204 if (!arrow_extensions->type_to_info[type_info].empty()) {
45205 return true;
45206 }
45207 type_info.type = LogicalTypeId::ANY;
45208 return !arrow_extensions->type_to_info[type_info].empty();
45209}

◆ HasArrowExtension() [2/2]

bool duckdb::DBConfig::HasArrowExtension ( ArrowExtensionMetadata info) const
45211 {
45212 lock_guard<mutex> l(arrow_extensions->lock);
45213 auto type_extensions = arrow_extensions->type_extensions;
45214
45215 if (type_extensions.find(info) != type_extensions.end()) {
45216 return true;
45217 }
45218
45219 auto og_info = info;
45220 info.SetArrowFormat("");
45221 if (type_extensions.find(info) != type_extensions.end()) {
45222 return true;
45223 }
45224
45225 return false;
45226}

◆ RegisterArrowExtension()

void duckdb::DBConfig::RegisterArrowExtension ( const ArrowTypeExtension & extension) const
45153 {
45154 lock_guard<mutex> l(arrow_extensions->lock);
45155 auto extension_info = extension.GetInfo();
45156 if (arrow_extensions->type_extensions.find(extension_info) != arrow_extensions->type_extensions.end()) {
45157 throw NotImplementedException("Arrow Extension with configuration %s is already registered",
45158 extension_info.ToString());
45159 }
45160 arrow_extensions->type_extensions[extension_info] = extension;
45161 if (extension.HasType()) {
45162 const TypeInfo type_info(extension.GetLogicalType());
45163 arrow_extensions->type_to_info[type_info].push_back(extension_info);
45164 return;
45165 }
45166 const TypeInfo type_info(extension.GetInfo().GetExtensionName());
45167 arrow_extensions->type_to_info[type_info].push_back(extension_info);
45168}

◆ operator==()

bool duckdb::DBConfig::operator== ( const DBConfig & other)
275234 {
275235 return other.options == options;
275236}

◆ operator!=()

bool duckdb::DBConfig::operator!= ( const DBConfig & other)
275238 {
275239 return !(other.options == options);
275240}

◆ GetCastFunctions()

CastFunctionSet & duckdb::DBConfig::GetCastFunctions ( )
275058 {
275059 return type_manager->GetCastFunctions();
275060}

◆ GetTypeManager()

TypeManager & duckdb::DBConfig::GetTypeManager ( )
275062 {
275063 return *type_manager;
275064}

◆ GetCollationBinding()

CollationBinding & duckdb::DBConfig::GetCollationBinding ( )
275066 {
275067 return *collation_bindings;
275068}

◆ GetIndexTypes()

IndexTypeSet & duckdb::DBConfig::GetIndexTypes ( )
275070 {
275071 return *index_types;
275072}

◆ GetSystemMaxThreads()

idx_t duckdb::DBConfig::GetSystemMaxThreads ( FileSystem & fs)
static
275117 {
275118#ifdef DUCKDB_NO_THREADS
275119 return 1;
275120#else
275121 idx_t physical_cores = std::thread::hardware_concurrency();
275122#ifdef __linux__
275123 if (const char *slurm_cpus = getenv("SLURM_CPUS_ON_NODE")) {
275124 idx_t slurm_threads;
275125 if (TryCast::Operation<string_t, idx_t>(string_t(slurm_cpus), slurm_threads)) {
275126 return MaxValue<idx_t>(slurm_threads, 1);
275127 }
275128 }
275129 return MaxValue<idx_t>(CGroups::GetCPULimit(fs, physical_cores), 1);
275130#else
275131 return MaxValue<idx_t>(physical_cores, 1);
275132#endif
275133#endif
275134}

◆ GetSystemAvailableMemory()

idx_t duckdb::DBConfig::GetSystemAvailableMemory ( FileSystem & fs)
static
275136 {
275137 // System memory detection
275138 auto memory = FileSystem::GetAvailableMemory();
275139 auto available_memory = memory.IsValid() ? memory.GetIndex() : DBConfigOptions().maximum_memory;
275140
275141#ifdef __linux__
275142 // Check SLURM environment variables first
275143 const char *slurm_mem_per_node = getenv("SLURM_MEM_PER_NODE");
275144 const char *slurm_mem_per_cpu = getenv("SLURM_MEM_PER_CPU");
275145
275146 if (slurm_mem_per_node) {
275147 auto limit = ParseMemoryLimitSlurm(slurm_mem_per_node);
275148 if (limit.IsValid()) {
275149 return limit.GetIndex();
275150 }
275151 } else if (slurm_mem_per_cpu) {
275152 auto mem_per_cpu = ParseMemoryLimitSlurm(slurm_mem_per_cpu);
275153 if (mem_per_cpu.IsValid()) {
275154 idx_t num_threads = GetSystemMaxThreads(fs);
275155 return mem_per_cpu.GetIndex() * num_threads;
275156 }
275157 }
275158
275159 // Check cgroup memory limit
275160 auto cgroup_memory_limit = CGroups::GetMemoryLimit(fs);
275161 if (cgroup_memory_limit.IsValid()) {
275162 auto cgroup_memory_limit_value = cgroup_memory_limit.GetIndex();
275163 return std::min(cgroup_memory_limit_value, available_memory);
275164 }
275165#endif
275166
275167 return available_memory;
275168}
static DUCKDB_API optional_idx GetAvailableMemory()
Returns the system-available memory in bytes. Returns DConstants::INVALID_INDEX if the system functio...
Definition duckdb.cpp:73651

◆ ParseMemoryLimitSlurm()

optional_idx duckdb::DBConfig::ParseMemoryLimitSlurm ( const string & arg)
static
275190 {
275191 if (arg.empty()) {
275192 return optional_idx();
275193 }
275194
275195 string number_str = arg;
275196 idx_t multiplier = 1000LL * 1000LL; // Default to MB if no unit specified
275197
275198 // Check for SLURM-style suffixes
275199 if (arg.back() == 'K' || arg.back() == 'k') {
275200 number_str = arg.substr(0, arg.size() - 1);
275201 multiplier = 1000LL;
275202 } else if (arg.back() == 'M' || arg.back() == 'm') {
275203 number_str = arg.substr(0, arg.size() - 1);
275204 multiplier = 1000LL * 1000LL;
275205 } else if (arg.back() == 'G' || arg.back() == 'g') {
275206 number_str = arg.substr(0, arg.size() - 1);
275207 multiplier = 1000LL * 1000LL * 1000LL;
275208 } else if (arg.back() == 'T' || arg.back() == 't') {
275209 number_str = arg.substr(0, arg.size() - 1);
275210 multiplier = 1000LL * 1000LL * 1000LL * 1000LL;
275211 }
275212
275213 // Parse the number
275214 double limit;
275215 if (!TryCast::Operation<string_t, double>(string_t(number_str), limit)) {
275216 return optional_idx();
275217 }
275218
275219 if (limit < 0) {
275220 return static_cast<idx_t>(NumericLimits<int64_t>::Maximum());
275221 }
275222 idx_t actual_limit = LossyNumericCast<idx_t>(static_cast<double>(multiplier) * limit);
275223 if (actual_limit == NumericLimits<idx_t>::Maximum()) {
275224 return static_cast<idx_t>(NumericLimits<int64_t>::Maximum());
275225 }
275226 return actual_limit;
275227}

◆ SetDefaultMaxMemory()

void duckdb::DBConfig::SetDefaultMaxMemory ( )
275074 {
275075 auto memory = GetSystemAvailableMemory(*file_system);
275076 if (memory == DBConfigOptions().maximum_memory) {
275077 // If GetSystemAvailableMemory returned the default, use it as is
275078 options.maximum_memory = memory;
275079 } else {
275080 // Otherwise, use 80% of the available memory
275081 options.maximum_memory = memory * 8 / 10;
275082 }
275083}
unique_ptr< FileSystem > file_system
The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purp...
Definition duckdb.hpp:40082

◆ SetDefaultTempDirectory()

void duckdb::DBConfig::SetDefaultTempDirectory ( )
275085 {
275086 if (!options.use_temporary_directory) {
275087 options.temporary_directory = string();
275088 } else if (DBConfig::IsInMemoryDatabase(options.database_path.c_str())) {
275089 options.temporary_directory = ".tmp";
275090 } else {
275091 options.temporary_directory = Path::AddSuffixToPath(options.database_path, ".tmp");
275092 }
275093}

◆ ResolveOrder()

OrderType duckdb::DBConfig::ResolveOrder ( ClientContext & context,
OrderType order_type ) const
275242 {
275243 if (order_type != OrderType::ORDER_DEFAULT) {
275244 return order_type;
275245 }
275246 return Settings::Get<DefaultOrderSetting>(context);
275247}

◆ ResolveNullOrder()

OrderByNullType duckdb::DBConfig::ResolveNullOrder ( ClientContext & context,
OrderType order_type,
OrderByNullType null_type ) const
275290 {
275291 if (null_type != OrderByNullType::ORDER_DEFAULT) {
275292 return null_type;
275293 }
275294 auto null_order = Settings::Get<DefaultNullOrderSetting>(context);
275295 switch (null_order) {
275296 case DefaultOrderByNullType::NULLS_FIRST:
275297 return OrderByNullType::NULLS_FIRST;
275298 case DefaultOrderByNullType::NULLS_LAST:
275299 return OrderByNullType::NULLS_LAST;
275300 case DefaultOrderByNullType::NULLS_FIRST_ON_ASC_LAST_ON_DESC:
275301 return order_type == OrderType::ASCENDING ? OrderByNullType::NULLS_FIRST : OrderByNullType::NULLS_LAST;
275302 case DefaultOrderByNullType::NULLS_LAST_ON_ASC_FIRST_ON_DESC:
275303 return order_type == OrderType::ASCENDING ? OrderByNullType::NULLS_LAST : OrderByNullType::NULLS_FIRST;
275304 default:
275305 throw InternalException("Unknown null order setting");
275306 }
275307}

◆ UserAgent()

const string duckdb::DBConfig::UserAgent ( ) const
275313 {
275314 auto user_agent = GetDefaultUserAgent();
275315
275316 auto duckdb_api = Settings::Get<DuckDBAPISetting>(*this);
275317 if (!duckdb_api.empty()) {
275318 user_agent += " " + duckdb_api;
275319 }
275320
275321 if (!options.custom_user_agent.empty()) {
275322 user_agent += " " + options.custom_user_agent;
275323 }
275324 return user_agent;
275325}

◆ TryGetCurrentSetting()

SettingLookupResult duckdb::DBConfig::TryGetCurrentSetting ( const string & key,
Value & result ) const

Returns the value of a setting currently. If the setting is not set by the user, returns the default value.

275262 {
275263 optional_ptr<const ConfigurationOption> option;
275264 auto setting_index = TryGetSettingIndex(key, option);
275265 if (setting_index.IsValid()) {
275266 auto lookup_result = TryGetCurrentUserSetting(setting_index.GetIndex(), result);
275267 if (lookup_result) {
275268 return lookup_result;
275269 }
275270 }
275271 return TryGetDefaultValue(option, result);
275272}
static SettingLookupResult TryGetDefaultValue(optional_ptr< const ConfigurationOption > option, Value &result)
Returns the default value of an option.
Definition duckdb.cpp:275253
SettingLookupResult TryGetCurrentUserSetting(idx_t setting_index, Value &result) const
Returns the value of a setting set by the user currently.
Definition duckdb.cpp:275249
Here is the call graph for this function:

◆ TryGetCurrentUserSetting()

SettingLookupResult duckdb::DBConfig::TryGetCurrentUserSetting ( idx_t setting_index,
Value & result ) const

Returns the value of a setting set by the user currently.

275249 {
275250 return user_settings.TryGetSetting(setting_index, result);
275251}
Here is the caller graph for this function:

◆ TryGetDefaultValue()

SettingLookupResult duckdb::DBConfig::TryGetDefaultValue ( optional_ptr< const ConfigurationOption > option,
Value & result )
static

Returns the default value of an option.

275253 {
275254 if (!option || !option->default_value) {
275255 return SettingLookupResult();
275256 }
275257 auto input_type = ParseLogicalType(option->parameter_type);
275258 result = Value(option->default_value).DefaultCastAs(input_type);
275259 return SettingLookupResult(SettingScope::GLOBAL);
275260}
@ GLOBAL
Setting is from the global Setting scope.
Definition duckdb.hpp:37010
Here is the caller graph for this function:

◆ CanAccessFile()

bool duckdb::DBConfig::CanAccessFile ( const string & path,
FileType type )
275393 {
275394 if (Settings::Get<EnableExternalAccessSetting>(*this)) {
275395 // all external access is allowed
275396 return true;
275397 }
275398 string path = SanitizeAllowedPath(input_path);
275399
275400 if (options.allowed_paths.count(path) > 0) {
275401 // path is explicitly allowed
275402 return true;
275403 }
275404
275405 if (options.allowed_directories.empty()) {
275406 // no prefix directories specified
275407 return false;
275408 }
275409 if (type == FileType::FILE_TYPE_DIR) {
275410 // make sure directories end with a /
275411 if (!StringUtil::EndsWith(path, "/")) {
275412 path += "/";
275413 }
275414 }
275415
275416 string prefix;
275417 for (const auto &allowed_directory : options.allowed_directories) {
275418 if (StringUtil::StartsWith(path, allowed_directory)) {
275419 prefix = allowed_directory;
275420 break;
275421 }
275422 }
275423
275424 if (prefix.empty()) {
275425 // no common prefix found - path is not inside an allowed directory
275426 return false;
275427 }
275428 D_ASSERT(StringUtil::EndsWith(prefix, "/"));
275429 return true;
275430}
@ FILE_TYPE_DIR
Directory.
Definition duckdb.hpp:8114

◆ AddAllowedConfig()

void duckdb::DBConfig::AddAllowedConfig ( const string & config_name)
275345 {
275346 if (config_name.empty()) {
275347 throw InvalidInputException("Cannot provide an empty string for allowed_configs");
275348 }
275349 duckdb::case_insensitive_set_t always_disallowed_config {"allowed_configs", "lock_configuration"};
275350 if (always_disallowed_config.find(config_name) != always_disallowed_config.end()) {
275351 throw InvalidInputException("Cannot include '%s' in allowed_configs", config_name);
275352 }
275353 // Validate that the config name refers to a known setting (built-in or extension)
275354 // and resolve aliases to canonical names
275355 auto option = GetOptionByName(config_name);
275356 if (option) {
275357 // Store the canonical name so alias lookups work in CheckLock
275358 options.allowed_configs.insert(option->name);
275359 return;
275360 }
275361 ExtensionOption extension_option;
275362 if (TryGetExtensionOption(config_name, extension_option)) {
275363 options.allowed_configs.insert(config_name);
275364 return;
275365 }
275366 // Check if the setting belongs to a known extension (even if not yet loaded)
275367 auto extension_name = ExtensionHelper::FindExtensionInEntries(config_name, EXTENSION_SETTINGS);
275368 if (!extension_name.empty()) {
275369 // Accept the setting - the extension may be autoloaded later when the setting is used
275370 options.allowed_configs.insert(config_name);
275371 return;
275372 }
275373 throw InvalidInputException("Unknown configuration option '%s' in allowed_configs", config_name);
275374}
static string FindExtensionInEntries(const string &name, const ExtensionEntry(&entries)[N])
Lookup a name in an ExtensionEntry list.
Definition duckdb.cpp:6376

◆ AddAllowedDirectory()

void duckdb::DBConfig::AddAllowedDirectory ( const string & path)
275376 {
275377 auto allowed_directory = SanitizeAllowedPath(path);
275378 if (allowed_directory.empty()) {
275379 throw InvalidInputException("Cannot provide an empty string for allowed_directory");
275380 }
275381 // ensure the directory ends with a path separator
275382 if (!StringUtil::EndsWith(allowed_directory, "/")) {
275383 allowed_directory += "/";
275384 }
275385 options.allowed_directories.insert(allowed_directory);
275386}

◆ AddAllowedPath()

void duckdb::DBConfig::AddAllowedPath ( const string & path)
275388 {
275389 auto allowed_path = SanitizeAllowedPath(path);
275390 options.allowed_paths.insert(allowed_path);
275391}

◆ SanitizeAllowedPath()

string duckdb::DBConfig::SanitizeAllowedPath ( const string & path) const
275335 {
275336 auto result = file_system->CanonicalizePath(path_p);
275337 // allowed_directories/allowed_path always uses forward slashes regardless of the OS
275338 auto path_sep = file_system->PathSeparator(path_p);
275339 if (path_sep != "/") {
275340 result = StringUtil::Replace(result, path_sep, "/");
275341 }
275342 return result;
275343}

◆ GetCallbackManager() [1/2]

ExtensionCallbackManager & duckdb::DBConfig::GetCallbackManager ( )
275327 {
275328 return *callback_manager;
275329}

◆ GetCallbackManager() [2/2]

const ExtensionCallbackManager & duckdb::DBConfig::GetCallbackManager ( ) const
275331 {
275332 return *callback_manager;
275333}

◆ SetHTTPUtil()

void duckdb::DBConfig::SetHTTPUtil ( const shared_ptr< HTTPUtil > & new_http_util)
275494 {
275495 lock_guard<mutex> guard(http_util_lock);
275496 old_http_utils.push_back(http_util);
275497 http_util.atomic_store(new_http_util);
275498}

◆ GetHTTPUtil()

HTTPUtil & duckdb::DBConfig::GetHTTPUtil ( ) const
275500 {
275501 return *http_util.atomic_load();
275502}

The documentation for this struct was generated from the following files: