added some additional methods to table for later use
This commit is contained in:
parent
4c63322024
commit
746fd9e8d2
|
|
@ -27,6 +27,7 @@ public:
|
|||
|
||||
[[nodiscard]] const std::string& table_name() const;
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
[[nodiscard]] std::string schema_name() const;
|
||||
[[nodiscard]] const std::vector<table_column>& columns() const;
|
||||
|
||||
[[nodiscard]] bool has_alias() const;
|
||||
|
|
@ -37,6 +38,12 @@ public:
|
|||
const table_column* operator[](const std::string& column_name) const;
|
||||
static const table_column* column_by_name(const table &tab, const std::string& column_name);
|
||||
|
||||
[[nodiscard]] bool is_relation_table() const;
|
||||
[[nodiscard]] bool has_primary_key() const;
|
||||
|
||||
[[nodiscard]] const std::string& join_column_name() const;
|
||||
[[nodiscard]] const std::string& inverse_join_column_name() const;
|
||||
|
||||
protected:
|
||||
static const table_column& create_column(class table& tab, const std::string& name);
|
||||
|
||||
|
|
@ -50,6 +57,10 @@ private:
|
|||
|
||||
std::string schema_name_;
|
||||
std::vector<table_column> columns_;
|
||||
|
||||
std::string pk_column_name_;
|
||||
std::string join_column_name_;
|
||||
std::string inverse_join_column_name_;
|
||||
};
|
||||
|
||||
template<typename Type = table>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,25 @@ const table_column * table::column_by_name(const table &tab, const std::string &
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
std::string table::schema_name() const {
|
||||
return schema_name_;
|
||||
}
|
||||
|
||||
bool table::is_relation_table() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool table::has_primary_key() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string &table::join_column_name() const {
|
||||
return join_column_name_;
|
||||
}
|
||||
|
||||
const std::string &table::inverse_join_column_name() const {
|
||||
return inverse_join_column_name_;
|
||||
}
|
||||
|
||||
const table_column& table::create_column(class table &tab, const std::string &name) {
|
||||
tab.columns_.emplace_back(name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue