A Binding represents a binding to a table, table-producing function or subquery with a specified table index.
More...
|
|
BindingType | binding_type |
| | The type of Binding.
|
|
BindingAlias | alias |
| | The alias of the binding.
|
|
idx_t | index |
| | The table index of the binding.
|
|
vector< LogicalType > | types |
| | The types of the bound columns.
|
|
vector< string > | names |
| | Column names of the subquery.
|
|
case_insensitive_map_t< column_t > | name_map |
| | Name -> index for the names.
|
A Binding represents a binding to a table, table-producing function or subquery with a specified table index.
◆ Binding()
385546 names(std::move(colnames)) {
385547 Initialize();
385548}
idx_t index
The table index of the binding.
Definition duckdb.cpp:1343
vector< LogicalType > types
The types of the bound columns.
Definition duckdb.cpp:1345
BindingAlias alias
The alias of the binding.
Definition duckdb.cpp:1341
vector< string > names
Column names of the subquery.
Definition duckdb.cpp:1347
BindingType binding_type
The type of Binding.
Definition duckdb.cpp:1339
◆ TryGetBindingIndex()
| bool duckdb::Binding::TryGetBindingIndex |
( |
const string & | column_name, |
|
|
column_t & | column_index ) |
385594 {
385595 auto entry =
name_map.find(column_name);
385597 return false;
385598 }
385599 auto column_info = entry->second;
385600 result = column_info;
385601 return true;
385602}
case_insensitive_map_t< column_t > name_map
Name -> index for the names.
Definition duckdb.cpp:1349
◆ GetBindingIndex()
| column_t duckdb::Binding::GetBindingIndex |
( |
const string & | column_name | ) |
|
385604 {
385606 if (!TryGetBindingIndex(column_name, result)) {
385607 throw InternalException("Binding index for column \"%s\" not found", column_name);
385608 }
385609 return result;
385610}
idx_t column_t
Type used for column identifiers.
Definition duckdb.hpp:259
◆ HasMatchingBinding()
| bool duckdb::Binding::HasMatchingBinding |
( |
const string & | column_name | ) |
|
385612 {
385614 return TryGetBindingIndex(column_name, result);
385615}
◆ ColumnNotFoundError()
| ErrorData duckdb::Binding::ColumnNotFoundError |
( |
const string & | column_name | ) |
const |
|
virtual |
385617 {
385618 return ErrorData(ExceptionType::BINDER,
StringUtil::Format(
"Values list \"%s\" does not have a column named \"%s\"",
385619 GetAlias(), column_name));
385620}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
◆ Bind()
Reimplemented in duckdb::DummyBinding.
385622 {
385624 bool success = false;
385625 success = TryGetBindingIndex(colref.GetColumnName(), column_index);
385626 if (!success) {
385627 return BindResult(ColumnNotFoundError(colref.GetColumnName()));
385628 }
385629 ColumnBinding binding;
385630 binding.table_index =
index;
385631 binding.column_index = column_index;
385632 LogicalType sql_type =
types[column_index];
385633 if (colref.GetAlias().empty()) {
385634 colref.SetAlias(
names[column_index]);
385635 }
385636 return BindResult(make_uniq<BoundColumnRefExpression>(colref.GetName(), sql_type, binding, depth));
385637}
◆ GetStandardEntry()
385639 {
385640 return nullptr;
385641}
◆ GetAlias() [1/3]
| string duckdb::Binding::GetAlias |
( |
| ) |
const |
385590 {
385591 return alias.GetAlias();
385592}
◆ GetBindingType()
| BindingType duckdb::Binding::GetBindingType |
( |
| ) |
|
◆ GetBindingAlias()
◆ GetIndex()
| idx_t duckdb::Binding::GetIndex |
( |
| ) |
|
◆ GetColumnTypes()
◆ GetColumnNames()
| const vector< string > & duckdb::Binding::GetColumnNames |
( |
| ) |
|
◆ GetColumnCount()
| idx_t duckdb::Binding::GetColumnCount |
( |
| ) |
|
385582 {
385583 return GetColumnNames().size();
385584}
◆ SetColumnType()
385586 {
385587 types[col_idx] = std::move(type_p);
385588}
◆ GetAlias() [2/3]
385643 {
385644 if (!explicit_alias.empty()) {
385645 return BindingAlias(explicit_alias);
385646 }
385647
385648 return BindingAlias(entry);
385649}
◆ GetAlias() [3/3]
385651 {
385652 if (!explicit_alias.empty()) {
385653 return BindingAlias(explicit_alias);
385654 }
385655 if (!entry) {
385656 throw InternalException("Binding::GetAlias called - but neither an alias nor an entry was provided");
385657 }
385658
385659 return BindingAlias(*entry);
385660}
◆ Cast() [1/2]
template<class TARGET>
| TARGET & duckdb::Binding::Cast |
( |
| ) |
|
|
inline |
1319 {
1321 throw InternalException("Failed to cast binding to type - binding type mismatch");
1322 }
1323 return reinterpret_cast<TARGET &>(*this);
1324 }
◆ Cast() [2/2]
template<class TARGET>
| const TARGET & duckdb::Binding::Cast |
( |
| ) |
const |
|
inline |
1327 {
1329 throw InternalException("Failed to cast binding to type - binding type mismatch");
1330 }
1331 return reinterpret_cast<const TARGET &>(*this);
1332 }
◆ Initialize()
| void duckdb::Binding::Initialize |
( |
| ) |
|
|
protected |
385550 {
385553 auto &name =
names[i];
385554 D_ASSERT(!name.empty());
385556 throw BinderException(
"table \"%s\" has duplicate column name \"%s\"",
alias.GetAlias(), name);
385557 }
385559 }
385560}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
The documentation for this struct was generated from the following file: