mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::db: Consider if column dropped for boolean test.
This commit is contained in:
parent
92154be55d
commit
c2521b587b
3 changed files with 27 additions and 2 deletions
|
@ -116,8 +116,8 @@ struct ircd::db::column
|
|||
explicit operator database &();
|
||||
explicit operator database::column &();
|
||||
|
||||
explicit operator bool() const { return bool(c); }
|
||||
bool operator!() const { return !c; }
|
||||
explicit operator bool() const;
|
||||
bool operator!() const;
|
||||
|
||||
// [GET] Iterations
|
||||
const_iterator begin(gopts = {});
|
||||
|
@ -294,6 +294,13 @@ const
|
|||
return *c;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ircd::db::column::operator!()
|
||||
const
|
||||
{
|
||||
return !bool(*this);
|
||||
}
|
||||
|
||||
inline ircd::db::column::operator
|
||||
database::column &()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace ircd::db
|
|||
const std::string &name(const database::column &);
|
||||
uint32_t id(const database::column &);
|
||||
|
||||
bool dropped(const database::column &);
|
||||
void drop(database::column &); // Request to erase column from db
|
||||
}
|
||||
|
||||
|
|
17
ircd/db.cc
17
ircd/db.cc
|
@ -1599,6 +1599,14 @@ ircd::db::drop(database::column &c)
|
|||
};
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::db::dropped(const database::column &c)
|
||||
{
|
||||
return c.descriptor?
|
||||
c.descriptor->drop:
|
||||
true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ircd::db::id(const database::column &c)
|
||||
{
|
||||
|
@ -5624,6 +5632,15 @@ const
|
|||
return { *this, key };
|
||||
}
|
||||
|
||||
ircd::db::column::operator
|
||||
bool()
|
||||
const
|
||||
{
|
||||
return c?
|
||||
!dropped(*c):
|
||||
false;
|
||||
}
|
||||
|
||||
ircd::db::column::operator
|
||||
const descriptor &()
|
||||
const
|
||||
|
|
Loading…
Reference in a new issue