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::DBPathAndType Struct Reference

Static Public Member Functions

static void ExtractExtensionPrefix (string &path, string &db_type)
 Parse database extension type and rest of path from combined form (type:path).
static void CheckMagicBytes (QueryContext context, FileSystem &fs, string &path, string &db_type)
 Check the magic bytes of a file and set the database type based on that.
static void ResolveDatabaseType (FileSystem &fs, string &path, string &db_type)
 Run ExtractExtensionPrefix followed by CheckMagicBytes.

Member Function Documentation

◆ ExtractExtensionPrefix()

void duckdb::DBPathAndType::ExtractExtensionPrefix ( string & path,
string & db_type )
static

Parse database extension type and rest of path from combined form (type:path).

277891 {
277892 auto extension = ExtensionHelper::ExtractExtensionPrefixFromPath(path);
277893 if (!extension.empty()) {
277894 // path is prefixed with an extension - remove the first occurence of it
277895 path = path.substr(extension.length() + 1);
277896 db_type = ExtensionHelper::ApplyExtensionAlias(extension);
277897 }
277898}
static string ApplyExtensionAlias(const string &extension_name)
Apply any known extension aliases, return the lowercase name.
Definition duckdb.cpp:278254
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckMagicBytes()

void duckdb::DBPathAndType::CheckMagicBytes ( QueryContext context,
FileSystem & fs,
string & path,
string & db_type )
static

Check the magic bytes of a file and set the database type based on that.

277900 {
277901 // if there isn't - check the magic bytes of the file (if any)
277902 auto file_type = MagicBytes::CheckMagicBytes(context, fs, path);
277903 db_type = string();
277904 switch (file_type) {
277905 case DataFileType::SQLITE_FILE:
277906 db_type = "sqlite";
277907 break;
277908 case DataFileType::PARQUET_FILE:
277909 case DataFileType::UNKNOWN_FILE: {
277910 // FIXME: we should get this from the registered replacement scans instead of hardcoding it here
277911 vector<string> supported_suffixes {"parquet", "csv", "tsv", "json", "jsonl", "ndjson"};
277912 if (ReplacementScan::CanReplace(path, supported_suffixes)) {
277913 db_type = "__open_file__";
277914 break;
277915 }
277916 break;
277917 }
277918 default:
277919 break;
277920 }
277921}
Here is the caller graph for this function:

◆ ResolveDatabaseType()

void duckdb::DBPathAndType::ResolveDatabaseType ( FileSystem & fs,
string & path,
string & db_type )
static

Run ExtractExtensionPrefix followed by CheckMagicBytes.

277923 {
277924 if (!db_type.empty()) {
277925 // database type specified explicitly - no need to check
277926 return;
277927 }
277928 // check for an extension prefix
277929 ExtractExtensionPrefix(path, db_type);
277930 if (!db_type.empty()) {
277931 // extension prefix was provided (e.g. sqlite:/path/to/file.db) - we are done
277932 return;
277933 }
277934 // check database type by reading the magic bytes of a file
277935 DBPathAndType::CheckMagicBytes(QueryContext(), fs, path, db_type);
277936}
static void CheckMagicBytes(QueryContext context, FileSystem &fs, string &path, string &db_type)
Check the magic bytes of a file and set the database type based on that.
Definition duckdb.cpp:277900
static void ExtractExtensionPrefix(string &path, string &db_type)
Parse database extension type and rest of path from combined form (type:path).
Definition duckdb.cpp:277891
Here is the call graph for this function:

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