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

Public Member Functions

string CopyOptionsToString () const
unique_ptr< CopyInfo > Copy () const
string ToString () const
string TablePartToString () const
void Serialize (Serializer &serializer) const override
Public Member Functions inherited from duckdb::ParseInfo
 ParseInfo (ParseInfoType info_type)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static unique_ptr< ParseInfo > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::ParseInfo
static unique_ptr< ParseInfo > Deserialize (Deserializer &deserializer)
static string QualifierToString (const string &catalog, const string &schema, const string &name)
static string TypeToString (CatalogType type)

Public Attributes

string catalog
 The catalog name to copy to/from.
string schema
 The schema name to copy to/from.
string table
 The table name to copy to/from.
vector< string > select_list
 List of columns to copy to/from.
bool is_from
 Whether or not this is a copy to file (false) or copy from a file (true).
string format
 The file format of the external file.
bool is_format_auto_detected
 If the format is manually set (i.e., via the format parameter) or was discovered by inspecting the file path.
unique_ptr< ParsedExpression > file_path_expression
 Expression to determine the file path (if any).
string file_path
 The file path to copy to/from.
case_insensitive_map_t< unique_ptr< ParsedExpression > > parsed_options
 Set of (key, value) options.
case_insensitive_map_t< vector< Value > > options
 Set of (key, value) options.
unique_ptr< QueryNode > select_statement
 The SQL statement used instead of a table when copying data out to a file.
Public Attributes inherited from duckdb::ParseInfo
ParseInfoType info_type

Static Public Attributes

static constexpr const ParseInfoType TYPE = ParseInfoType::COPY_INFO

Constructor & Destructor Documentation

◆ CopyInfo()

duckdb::CopyInfo::CopyInfo ( )
339081 : ParseInfo(TYPE), catalog(INVALID_CATALOG), schema(DEFAULT_SCHEMA), is_from(false), is_format_auto_detected(true) {
339082}
bool is_from
Whether or not this is a copy to file (false) or copy from a file (true).
Definition duckdb.hpp:57795
string catalog
The catalog name to copy to/from.
Definition duckdb.hpp:57787
string schema
The schema name to copy to/from.
Definition duckdb.hpp:57789
bool is_format_auto_detected
If the format is manually set (i.e., via the format parameter) or was discovered by inspecting the fi...
Definition duckdb.hpp:57799

Member Function Documentation

◆ CopyOptionsToString()

string duckdb::CopyInfo::CopyOptionsToString ( ) const
339105 {
339106 // We only output the format if there is a format, and it was manually set.
339107 const bool output_format = !format.empty() && !is_format_auto_detected;
339108 if (!output_format && options.empty() && parsed_options.empty()) {
339109 return string();
339110 }
339111 string result;
339112
339113 result += " (";
339114 vector<string> stringified;
339115 if (!format.empty() && !is_format_auto_detected) {
339116 stringified.push_back(StringUtil::Format(" FORMAT %s", format));
339117 }
339118 for (auto &opt : parsed_options) {
339119 auto &name = opt.first;
339120 auto &expr = opt.second;
339121 string option_string = name;
339122 if (expr) {
339123 option_string += " " + expr->ToString();
339124 }
339125 stringified.push_back(option_string);
339126 }
339127 for (auto &opt : options) {
339128 auto &name = opt.first;
339129 auto &values = opt.second;
339130
339131 auto option = name + " ";
339132 if (values.empty()) {
339133 // Options like HEADER don't need an explicit value
339134 // just providing the name already sets it to true
339135 stringified.push_back(option);
339136 } else if (values.size() == 1) {
339137 stringified.push_back(option + values[0].ToSQLString());
339138 } else {
339139 vector<string> sub_values;
339140 for (auto &val : values) {
339141 sub_values.push_back(val.ToSQLString());
339142 }
339143 stringified.push_back(option + "( " + StringUtil::Join(sub_values, ", ") + " )");
339144 }
339145 }
339146 result += StringUtil::Join(stringified, ", ");
339147 result += " )";
339148 return result;
339149}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
static DUCKDB_API string Join(const vector< string > &input, const string &separator)
Join multiple strings into one string. Components are concatenated by the given separator.
Definition duckdb.cpp:109497
case_insensitive_map_t< vector< Value > > options
Set of (key, value) options.
Definition duckdb.hpp:57807
string format
The file format of the external file.
Definition duckdb.hpp:57797
case_insensitive_map_t< unique_ptr< ParsedExpression > > parsed_options
Set of (key, value) options.
Definition duckdb.hpp:57805

◆ Copy()

unique_ptr< CopyInfo > duckdb::CopyInfo::Copy ( ) const
339084 {
339085 auto result = make_uniq<CopyInfo>();
339086 result->catalog = catalog;
339087 result->schema = schema;
339088 result->table = table;
339089 result->select_list = select_list;
339090 result->file_path_expression = file_path_expression ? file_path_expression->Copy() : nullptr;
339091 result->file_path = file_path;
339092 result->is_from = is_from;
339093 result->format = format;
339094 result->is_format_auto_detected = is_format_auto_detected;
339095 for (auto &entry : parsed_options) {
339096 result->parsed_options[entry.first] = entry.second ? entry.second->Copy() : nullptr;
339097 }
339098 result->options = options;
339099 if (select_statement) {
339100 result->select_statement = select_statement->Copy();
339101 }
339102 return result;
339103}
vector< string > select_list
List of columns to copy to/from.
Definition duckdb.hpp:57793
string table
The table name to copy to/from.
Definition duckdb.hpp:57791
unique_ptr< ParsedExpression > file_path_expression
Expression to determine the file path (if any).
Definition duckdb.hpp:57801
unique_ptr< QueryNode > select_statement
The SQL statement used instead of a table when copying data out to a file.
Definition duckdb.hpp:57809
string file_path
The file path to copy to/from.
Definition duckdb.hpp:57803

◆ ToString()

string duckdb::CopyInfo::ToString ( ) const
339170 {
339171 string result = "";
339172 result += "COPY ";
339173 if (is_from) {
339174 D_ASSERT(!select_statement);
339175 result += TablePartToString();
339176 result += " FROM";
339177 } else {
339178 if (select_statement) {
339179 // COPY (select-node) TO ...
339180 result += "(" + select_statement->ToString() + ")";
339181 } else {
339182 result += TablePartToString();
339183 }
339184 result += " TO ";
339185 }
339186 if (file_path_expression && file_path.empty()) {
339187 result += "(";
339188 result += file_path_expression->ToString();
339189 result += ")";
339190 } else {
339191 result += StringUtil::Format(" %s", SQLString(file_path));
339192 }
339193 result += CopyOptionsToString();
339194 result += ";";
339195 return result;
339196}

◆ TablePartToString()

string duckdb::CopyInfo::TablePartToString ( ) const
339151 {
339152 string result;
339153
339154 D_ASSERT(!table.empty());
339155 result += QualifierToString(catalog, schema, table);
339156
339157 // (c1, c2, ..)
339158 if (!select_list.empty()) {
339159 vector<string> options;
339160 for (auto &option : select_list) {
339162 }
339163 result += " (";
339164 result += StringUtil::Join(options, ", ");
339165 result += " )";
339166 }
339167 return result;
339168}
static string WriteOptionallyQuoted(const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE)
Writes a string that is optionally quoted + escaped so it can be used as an identifier.
Definition duckdb.cpp:338034

◆ Serialize()

void duckdb::CopyInfo::Serialize ( Serializer & serializer) const
overridevirtual

Reimplemented from duckdb::ParseInfo.

418290 {
418291 ParseInfo::Serialize(serializer);
418292 serializer.WritePropertyWithDefault<string>(200, "catalog", catalog);
418293 serializer.WritePropertyWithDefault<string>(201, "schema", schema);
418294 serializer.WritePropertyWithDefault<string>(202, "table", table);
418295 serializer.WritePropertyWithDefault<vector<string>>(203, "select_list", select_list);
418296 serializer.WritePropertyWithDefault<bool>(204, "is_from", is_from);
418297 serializer.WritePropertyWithDefault<string>(205, "format", format);
418298 serializer.WritePropertyWithDefault<string>(206, "file_path", file_path);
418299 serializer.WritePropertyWithDefault<case_insensitive_map_t<vector<Value>>>(207, "options", options);
418300 serializer.WritePropertyWithDefault<unique_ptr<QueryNode>>(208, "select_statement", select_statement);
418301 serializer.WritePropertyWithDefault<bool>(209, "is_format_auto_detected", is_format_auto_detected);
418302}

◆ Deserialize()

unique_ptr< ParseInfo > duckdb::CopyInfo::Deserialize ( Deserializer & deserializer)
static
418304 {
418305 auto result = duckdb::unique_ptr<CopyInfo>(new CopyInfo());
418306 deserializer.ReadPropertyWithDefault<string>(200, "catalog", result->catalog);
418307 deserializer.ReadPropertyWithDefault<string>(201, "schema", result->schema);
418308 deserializer.ReadPropertyWithDefault<string>(202, "table", result->table);
418309 deserializer.ReadPropertyWithDefault<vector<string>>(203, "select_list", result->select_list);
418310 deserializer.ReadPropertyWithDefault<bool>(204, "is_from", result->is_from);
418311 deserializer.ReadPropertyWithDefault<string>(205, "format", result->format);
418312 deserializer.ReadPropertyWithDefault<string>(206, "file_path", result->file_path);
418313 deserializer.ReadPropertyWithDefault<case_insensitive_map_t<vector<Value>>>(207, "options", result->options);
418314 deserializer.ReadPropertyWithDefault<unique_ptr<QueryNode>>(208, "select_statement", result->select_statement);
418315 deserializer.ReadPropertyWithDefault<bool>(209, "is_format_auto_detected", result->is_format_auto_detected);
418316 return std::move(result);
418317}

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