62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
#include "matador/query/table.hpp"
|
|
|
|
namespace matador::query {
|
|
|
|
table::table(const char* name)
|
|
: table(std::string(name))
|
|
{}
|
|
|
|
table::table(std::string name)
|
|
: name_(std::move(name))
|
|
{}
|
|
|
|
table::table(const char *name, std::string as)
|
|
: name_(name)
|
|
, alias_(std::move(as))
|
|
{}
|
|
|
|
table::table(std::string name, std::string as)
|
|
: name_(std::move(name))
|
|
, alias_(std::move(as))
|
|
{}
|
|
|
|
table::table( std::string name, std::string as, const std::vector<column>& columns )
|
|
: name_(std::move(name))
|
|
, alias_(std::move(as))
|
|
, columns_(columns) {}
|
|
|
|
bool table::operator==( const table& x ) const {
|
|
return name_ == x.name_;
|
|
}
|
|
|
|
table & table::as(const std::string &a) {
|
|
alias_ = a;
|
|
return *this;
|
|
}
|
|
|
|
table table::as(const std::string &a) const {
|
|
return { name_, a, columns_ };
|
|
}
|
|
|
|
bool table::has_alias() const {
|
|
return !alias_.empty();
|
|
}
|
|
|
|
const std::string& table::name() const {
|
|
return name_;
|
|
}
|
|
|
|
const std::string& table::alias() const {
|
|
return alias_;
|
|
}
|
|
|
|
const std::vector<column>& table::columns() const {
|
|
return columns_;
|
|
}
|
|
|
|
table operator ""_tab(const char *name, size_t len) {
|
|
return {{name, len}};
|
|
}
|
|
|
|
}
|