MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / Query

Class Query

tiledb/sm/cpp_api/query.h:85–1217  ·  view source on GitHub ↗

* Construct and execute read/write queries on a tiledb::Array. * * @details * See examples for more usage details. * * **Example:** * * @code{.cpp} * // Open the array for writing * tiledb::Context ctx; * tiledb::Array array(ctx, "my_dense_array", TILEDB_WRITE); * Query query(ctx, array); * query.set_layout(TILEDB_GLOBAL_ORDER); * std::vector a1_data = {1, 2, 3}; * query.set_data_buf

Source from the content-addressed store, hash-verified

83 * @endcode
84 */
85class Query {
86 public:
87 /* ********************************* */
88 /* TYPE DEFINITIONS */
89 /* ********************************* */
90
91 /** The query or query attribute status. */
92 enum class Status {
93 /** Query failed. */
94 FAILED,
95 /** Query completed (all data has been read) */
96 COMPLETE,
97 /** Query is in progress */
98 INPROGRESS,
99 /** Query completed (but not all data has been read) */
100 INCOMPLETE,
101 /** Query not initialized. */
102 UNINITIALIZED,
103 /** Query initialized (strategy created). */
104 INITIALIZED
105 };
106
107 /* ********************************* */
108 /* CONSTRUCTORS & DESTRUCTORS */
109 /* ********************************* */
110
111 /**
112 * Creates a TileDB query object.
113 *
114 * The query type (read or write) must be the same as the type used to open
115 * the array object.
116 *
117 * The storage manager also acquires a **shared lock** on the array. This
118 * means multiple read and write queries to the same array can be made
119 * concurrently (in TileDB, only consolidation requires an exclusive lock for
120 * a short period of time).
121 *
122 * **Example:**
123 *
124 * @code{.cpp}
125 * // Open the array for writing
126 * tiledb::Context ctx;
127 * tiledb::Array array(ctx, "my_array", TILEDB_WRITE);
128 * tiledb::Query query(ctx, array, TILEDB_WRITE);
129 * @endcode
130 *
131 * @param ctx TileDB context
132 * @param array Open Array object
133 * @param type The TileDB query type
134 */
135 Query(const Context& ctx, const Array& array, tiledb_query_type_t type)
136 : ctx_(ctx)
137 , array_(array)
138 , schema_(array.schema()) {
139 tiledb_query_t* q;
140 ctx.handle_error(
141 tiledb_query_alloc(ctx.ptr().get(), array.ptr().get(), type, &q));
142 query_ = std::shared_ptr<tiledb_query_t>(q, deleter_);

Callers

nothing calls this directly

Tested by

no test coverage detected