diff --git a/libtiledbsoma/src/soma/managed_query.cc b/libtiledbsoma/src/soma/managed_query.cc index 2cbac09146..946334e1b0 100644 --- a/libtiledbsoma/src/soma/managed_query.cc +++ b/libtiledbsoma/src/soma/managed_query.cc @@ -56,6 +56,17 @@ ManagedQuery::ManagedQuery( reset(); } +ManagedQuery::ManagedQuery( + std::unique_ptr array, + std::shared_ptr ctx, + std::string_view name) + : array_(array->arr_) + , ctx_(ctx) + , name_(name) + , schema_(std::make_shared(array->arr_->schema())) { + reset(); +} + void ManagedQuery::close() { array_->close(); } diff --git a/libtiledbsoma/src/soma/managed_query.h b/libtiledbsoma/src/soma/managed_query.h index c538a0989f..5819e590bb 100644 --- a/libtiledbsoma/src/soma/managed_query.h +++ b/libtiledbsoma/src/soma/managed_query.h @@ -48,6 +48,7 @@ namespace tiledbsoma { using namespace tiledb; +class SOMAArray; // Probably we should just use a std::tuple here class StatusAndException { @@ -86,6 +87,11 @@ class ManagedQuery { std::shared_ptr ctx, std::string_view name = "unnamed"); + ManagedQuery( + std::unique_ptr array, + std::shared_ptr ctx, + std::string_view name = "unnamed"); + ManagedQuery() = delete; ManagedQuery(const ManagedQuery&) = delete; @@ -406,6 +412,16 @@ class ManagedQuery { return query_->query_type(); } + /** + * @brief Return the query status. + * + * @return tiledb::Query::Status INCOMPLETE, COMPLETE, INPROGRESS, FAILED, + * UNINITIALIZED, or INITIALIZED + */ + Query::Status query_status() const { + return query_->query_status(); + } + private: //=================================================================== //= private non-static diff --git a/libtiledbsoma/src/soma/soma_array.h b/libtiledbsoma/src/soma/soma_array.h index 68d478e871..1bf5ba5992 100644 --- a/libtiledbsoma/src/soma/soma_array.h +++ b/libtiledbsoma/src/soma/soma_array.h @@ -98,6 +98,8 @@ enum class Domainish { class SOMAArray : public SOMAObject { public: + friend class ManagedQuery; + //=================================================================== //= public static //===================================================================