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::CatalogSearchEntry Struct Reference
Collaboration diagram for duckdb::CatalogSearchEntry:

Public Member Functions

 CatalogSearchEntry (string catalog, string schema)
 
string ToString () const
 

Static Public Member Functions

static string ListToString (const vector< CatalogSearchEntry > &input)
 
static CatalogSearchEntry Parse (const string &input)
 
static vector< CatalogSearchEntryParseList (const string &input)
 

Public Attributes

string catalog
 
string schema
 

Static Private Member Functions

static CatalogSearchEntry ParseInternal (const string &input, idx_t &pos)
 
static string WriteOptionallyQuoted (const string &input)
 

Constructor & Destructor Documentation

◆ CatalogSearchEntry()

duckdb::CatalogSearchEntry::CatalogSearchEntry ( string  catalog,
string  schema 
)
22291 : catalog(std::move(catalog_p)), schema(std::move(schema_p)) {
22292}

Member Function Documentation

◆ ToString()

string duckdb::CatalogSearchEntry::ToString ( ) const
22294 {
22295 if (catalog.empty()) {
22296 return WriteOptionallyQuoted(schema);
22297 } else {
22298 return WriteOptionallyQuoted(catalog) + "." + WriteOptionallyQuoted(schema);
22299 }
22300}

◆ ListToString()

string duckdb::CatalogSearchEntry::ListToString ( const vector< CatalogSearchEntry > &  input)
static
22311 {
22312 string result;
22313 for (auto &entry : input) {
22314 if (!result.empty()) {
22315 result += ",";
22316 }
22317 result += entry.ToString();
22318 }
22319 return result;
22320}

◆ Parse()

CatalogSearchEntry duckdb::CatalogSearchEntry::Parse ( const string &  input)
static
22385 {
22386 idx_t pos = 0;
22387 auto result = ParseInternal(input, pos);
22388 if (pos < input.size()) {
22389 throw ParserException("Failed to convert entry \"%s\" to CatalogSearchEntry - expected a single entry", input);
22390 }
22391 return result;
22392}
static CatalogSearchEntry ParseInternal(const string &input, idx_t &pos)
Definition duckdb.cpp:22322

◆ ParseList()

vector< CatalogSearchEntry > duckdb::CatalogSearchEntry::ParseList ( const string &  input)
static
22394 {
22395 idx_t pos = 0;
22396 vector<CatalogSearchEntry> result;
22397 while (pos < input.size()) {
22398 auto entry = ParseInternal(input, pos);
22399 result.push_back(entry);
22400 }
22401 return result;
22402}

◆ ParseInternal()

CatalogSearchEntry duckdb::CatalogSearchEntry::ParseInternal ( const string &  input,
idx_t pos 
)
staticprivate

look for another quote

unquote

22322 {
22323 string catalog;
22324 string schema;
22325 string entry;
22326 bool finished = false;
22327normal:
22328 for (; idx < input.size(); idx++) {
22329 if (input[idx] == '"') {
22330 idx++;
22331 goto quoted;
22332 } else if (input[idx] == '.') {
22333 goto separator;
22334 } else if (input[idx] == ',') {
22335 finished = true;
22336 goto separator;
22337 }
22338 entry += input[idx];
22339 }
22340 finished = true;
22341 goto separator;
22342quoted:
22344 for (; idx < input.size(); idx++) {
22345 if (input[idx] == '"') {
22347 idx++;
22348 if (idx < input.size() && input[idx] == '"') {
22349 // escaped quote
22350 entry += input[idx];
22351 continue;
22352 }
22353 goto normal;
22354 }
22355 entry += input[idx];
22356 }
22357 throw ParserException("Unterminated quote in qualified name!");
22358separator:
22359 if (entry.empty()) {
22360 throw ParserException("Unexpected dot - empty CatalogSearchEntry");
22361 }
22362 if (schema.empty()) {
22363 // if we parse one entry it is the schema
22364 schema = std::move(entry);
22365 } else if (catalog.empty()) {
22366 // if we parse two entries it is [catalog.schema]
22367 catalog = std::move(schema);
22368 schema = std::move(entry);
22369 } else {
22370 throw ParserException("Too many dots - expected [schema] or [catalog.schema] for CatalogSearchEntry");
22371 }
22372 entry = "";
22373 idx++;
22374 if (finished) {
22375 goto final;
22376 }
22377 goto normal;
22378final:
22379 if (schema.empty()) {
22380 throw ParserException("Unexpected end of entry - empty CatalogSearchEntry");
22381 }
22382 return CatalogSearchEntry(std::move(catalog), std::move(schema));
22383}

◆ WriteOptionallyQuoted()

string duckdb::CatalogSearchEntry::WriteOptionallyQuoted ( const string &  input)
staticprivate
22302 {
22303 for (idx_t i = 0; i < input.size(); i++) {
22304 if (input[i] == '.' || input[i] == ',' || input[i] == '"') {
22305 return "\"" + StringUtil::Replace(input, "\"", "\"\"") + "\"";
22306 }
22307 }
22308 return input;
22309}

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