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::MergeIntoAction Class Reference
Collaboration diagram for duckdb::MergeIntoAction:

Public Member Functions

string ToString () const
unique_ptr< MergeIntoAction > Copy () const

Public Attributes

MergeActionType action_type
 The merge action type.
unique_ptr< ParsedExpression > condition
 Condition - or NULL if this should always be performed for the given action.
unique_ptr< UpdateSetInfo > update_info
 The SET information (if action_type == MERGE_UPDATE).
vector< string > insert_columns
 Column names to insert into (if action_type == MERGE_INSERT).
vector< unique_ptr< ParsedExpression > > expressions
 Set of expressions for INSERT.
InsertColumnOrder column_order = InsertColumnOrder::INSERT_BY_POSITION
 INSERT BY POSITION or INSERT BY NAME.
bool default_values = false
 Whether or not this is a INSERT DEFAULT VALUES.

Member Function Documentation

◆ ToString()

string duckdb::MergeIntoAction::ToString ( ) const
349665 {
349666 string result;
349667 if (condition) {
349668 result += " AND " + condition->ToString() + " ";
349669 }
349670 result += "THEN ";
349671 switch (action_type) {
349672 case MergeActionType::MERGE_UPDATE:
349673 result += "UPDATE ";
349674 if (column_order == InsertColumnOrder::INSERT_BY_NAME) {
349675 result += "BY NAME ";
349676 }
349677 if (update_info) {
349678 result += update_info->ToString();
349679 }
349680 break;
349681 case MergeActionType::MERGE_DELETE:
349682 result += "DELETE";
349683 break;
349684 case MergeActionType::MERGE_INSERT:
349685 result += "INSERT ";
349686 if (column_order == InsertColumnOrder::INSERT_BY_NAME) {
349687 result += "BY NAME ";
349688 }
349689 if (!insert_columns.empty()) {
349690 result += "(";
349691 for (idx_t c = 0; c < insert_columns.size(); c++) {
349692 if (c > 0) {
349693 result += ", ";
349694 }
349696 }
349697 result += ") ";
349698 }
349699 if (expressions.empty()) {
349700 if (default_values) {
349701 result += "DEFAULT VALUES";
349702 } else {
349703 result += "*";
349704 }
349705 } else {
349706 result += "VALUES (";
349707 for (idx_t c = 0; c < expressions.size(); c++) {
349708 if (c > 0) {
349709 result += ", ";
349710 }
349711 result += expressions[c]->ToString();
349712 }
349713 result += ")";
349714 }
349715 break;
349716 case MergeActionType::MERGE_DO_NOTHING:
349717 result += "DO NOTHING";
349718 break;
349719 case MergeActionType::MERGE_ERROR:
349720 result += "ERROR";
349721 if (!expressions.empty()) {
349722 result += " " + expressions[0]->ToString();
349723 }
349724 break;
349725 default:
349726 throw InternalException("Unsupported merge action in ToString");
349727 }
349728 return result;
349729}
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
vector< unique_ptr< ParsedExpression > > expressions
Set of expressions for INSERT.
Definition duckdb.cpp:196299
bool default_values
Whether or not this is a INSERT DEFAULT VALUES.
Definition duckdb.cpp:196303
vector< string > insert_columns
Column names to insert into (if action_type == MERGE_INSERT).
Definition duckdb.cpp:196297
unique_ptr< ParsedExpression > condition
Condition - or NULL if this should always be performed for the given action.
Definition duckdb.cpp:196293
MergeActionType action_type
The merge action type.
Definition duckdb.cpp:196291
InsertColumnOrder column_order
INSERT BY POSITION or INSERT BY NAME.
Definition duckdb.cpp:196301
unique_ptr< UpdateSetInfo > update_info
The SET information (if action_type == MERGE_UPDATE).
Definition duckdb.cpp:196295
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Copy()

unique_ptr< MergeIntoAction > duckdb::MergeIntoAction::Copy ( ) const
349731 {
349732 auto result = make_uniq<MergeIntoAction>();
349733 result->action_type = action_type;
349734 result->condition = condition ? condition->Copy() : nullptr;
349735 result->update_info = update_info ? update_info->Copy() : nullptr;
349736 result->insert_columns = insert_columns;
349737 result->default_values = default_values;
349738 result->column_order = column_order;
349739 for (auto &expr : expressions) {
349740 result->expressions.push_back(expr->Copy());
349741 }
349742 return result;
349743}

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