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

Public Member Functions

string ToString () const override
unique_ptr< SQLStatement > Copy () const override
 Create a copy of this SelectStatement.
Public Member Functions inherited from duckdb::SQLStatement
 SQLStatement (StatementType type)
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static string ActionConditionToString (MergeActionCondition condition)

Public Attributes

unique_ptr< TableRef > target
unique_ptr< TableRef > source
unique_ptr< ParsedExpression > join_condition
vector< string > using_columns
map< MergeActionCondition, vector< unique_ptr< MergeIntoAction > > > actions
vector< unique_ptr< ParsedExpression > > returning_list
 keep track of optional returningList if statement contains a RETURNING keyword
CommonTableExpressionMap cte_map
 CTEs.
Public Attributes inherited from duckdb::SQLStatement
StatementType type
 The statement type.
idx_t stmt_location = 0
 The statement location within the query string.
idx_t stmt_length = 0
 The statement length within the query string.
case_insensitive_map_t< idx_t > named_param_map
 The map of named parameter to param index.
string query
 The query text that corresponds to this SQL statement.

Static Public Attributes

static constexpr const StatementType TYPE = StatementType::MERGE_INTO_STATEMENT
Static Public Attributes inherited from duckdb::SQLStatement
static constexpr const StatementType TYPE = StatementType::INVALID_STATEMENT

Protected Member Functions

 MergeIntoStatement (const MergeIntoStatement &other)
Protected Member Functions inherited from duckdb::SQLStatement
 SQLStatement (const SQLStatement &other)=default

Constructor & Destructor Documentation

◆ MergeIntoStatement() [1/2]

duckdb::MergeIntoStatement::MergeIntoStatement ( )
349583 : SQLStatement(StatementType::MERGE_INTO_STATEMENT) {
349584}

◆ MergeIntoStatement() [2/2]

duckdb::MergeIntoStatement::MergeIntoStatement ( const MergeIntoStatement & other)
protected
349586 : SQLStatement(other) {
349587 target = other.target->Copy();
349588 source = other.source->Copy();
349589 join_condition = other.join_condition ? other.join_condition->Copy() : nullptr;
349590 using_columns = other.using_columns;
349591 for (auto &entry : other.actions) {
349592 auto &action_list = actions[entry.first];
349593 for (auto &action : entry.second) {
349594 action_list.push_back(action->Copy());
349595 }
349596 }
349597 for (auto &entry : other.returning_list) {
349598 returning_list.push_back(entry->Copy());
349599 }
349600 cte_map = other.cte_map.Copy();
349601}
vector< unique_ptr< ParsedExpression > > returning_list
keep track of optional returningList if statement contains a RETURNING keyword
Definition duckdb.cpp:196324
CommonTableExpressionMap cte_map
CTEs.
Definition duckdb.cpp:196327

Member Function Documentation

◆ ToString()

string duckdb::MergeIntoStatement::ToString ( ) const
overridevirtual

Implements duckdb::SQLStatement.

349616 {
349617 string result;
349618 result = cte_map.ToString();
349619 result += "MERGE INTO ";
349620 result += target->ToString();
349621 result += " USING ";
349622 result += source->ToString();
349623 if (join_condition) {
349624 result += " ON ";
349625 result += join_condition->ToString();
349626 } else {
349627 result += " USING (";
349628 for (idx_t c = 0; c < using_columns.size(); c++) {
349629 if (c > 0) {
349630 result += ", ";
349631 }
349632 result += using_columns[c];
349633 }
349634 result += ")";
349635 }
349636 for (auto &entry : actions) {
349637 for (auto &action : entry.second) {
349638 result += " ";
349639 result += MergeIntoStatement::ActionConditionToString(entry.first);
349640 result += " ";
349641 result += action->ToString();
349642 }
349643 }
349644 if (!returning_list.empty()) {
349645 result += " RETURNING ";
349646 for (idx_t i = 0; i < returning_list.size(); i++) {
349647 if (i > 0) {
349648 result += ", ";
349649 }
349650 auto column = returning_list[i]->ToString();
349651 if (!returning_list[i]->GetAlias().empty()) {
349652 column +=
349654 }
349655 result += column;
349656 }
349657 }
349658 return result;
349659}
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
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Copy()

unique_ptr< SQLStatement > duckdb::MergeIntoStatement::Copy ( ) const
overridevirtual

Create a copy of this SelectStatement.

Implements duckdb::SQLStatement.

349661 {
349662 return unique_ptr<MergeIntoStatement>(new MergeIntoStatement(*this));
349663}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ActionConditionToString()

string duckdb::MergeIntoStatement::ActionConditionToString ( MergeActionCondition condition)
static
349603 {
349604 switch (condition) {
349605 case MergeActionCondition::WHEN_MATCHED:
349606 return "WHEN MATCHED";
349607 case MergeActionCondition::WHEN_NOT_MATCHED_BY_TARGET:
349608 return "WHEN NOT MATCHED";
349609 case MergeActionCondition::WHEN_NOT_MATCHED_BY_SOURCE:
349610 return "WHEN NOT MATCHED BY SOURCE";
349611 default:
349612 throw InternalException("Unknown match condition");
349613 }
349614}

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