added index attribute to field class

This commit is contained in:
2024-03-10 17:22:38 +01:00
parent 6bbc870362
commit 9a02abacea
3 changed files with 22 additions and 4 deletions
+15 -2
View File
@@ -3,21 +3,29 @@
namespace matador::sql {
field::field(std::string name)
: name_(std::move(name)), value_(nullptr), type_(field_traits<nullptr_t>::type())
: name_(std::move(name))
, value_(nullptr)
, type_(field_traits<nullptr_t>::type())
{}
field::field(field &&x) noexcept
: name_(std::move(x.name_)), value_(std::move(x.value_)), type_(x.type_)
: name_(std::move(x.name_))
, index_(x.index_)
, value_(std::move(x.value_))
, type_(x.type_)
{
x.value_ = nullptr;
x.index_ = -1;
x.type_ = field_type::Null;
}
field &field::operator=(field &&x) noexcept
{
name_ = std::move(x.name_);
index_ = x.index_;
value_ = std::move(x.value_);
type_ = x.type_;
x.index_ = -1;
x.value_ = nullptr;
x.type_ = field_type::Null;
@@ -29,6 +37,11 @@ const std::string &field::name() const
return name_;
}
int field::index() const
{
return index_;
}
std::ostream &operator<<(std::ostream &out, const field &col)
{
out << col.str();