diff --git a/include/ircd/db/column.h b/include/ircd/db/column.h index 6d8bcb5ec..abf54d3e7 100644 --- a/include/ircd/db/column.h +++ b/include/ircd/db/column.h @@ -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 &() { diff --git a/include/ircd/db/database/column.h b/include/ircd/db/database/column.h index 3fcbe9cc8..c7877cbb7 100644 --- a/include/ircd/db/database/column.h +++ b/include/ircd/db/database/column.h @@ -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 } diff --git a/ircd/db.cc b/ircd/db.cc index 0e9e28ef6..c5a9cef41 100644 --- a/ircd/db.cc +++ b/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