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

Method write_update_condition

test/src/unit-cppapi-update-queries.cc:136–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void UpdatesFx::write_update_condition(
137 QueryCondition& qc,
138 std::vector<sm::UpdateValue>& uvs,
139 uint64_t timestamp,
140 bool encrypt,
141 bool error_expected) {
142 // Open array.
143 std::unique_ptr<Array> array;
144 if (encrypt) {
145 array = std::make_unique<Array>(
146 ctx_,
147 SPARSE_ARRAY_NAME,
148 TILEDB_UPDATE,
149 TemporalPolicy(TimeTravel, timestamp),
150 EncryptionAlgorithm(AESGCM, key_.c_str()));
151 } else {
152 array = std::make_unique<Array>(
153 ctx_,
154 SPARSE_ARRAY_NAME,
155 TILEDB_UPDATE,
156 TemporalPolicy(TimeTravel, timestamp));
157 }
158
159 // Create query.
160 Query query(ctx_, *array, TILEDB_UPDATE);
161
162 query.set_condition(qc);
163 for (auto& uv : uvs) {
164 QueryExperimental::add_update_value_to_query(
165 ctx_,
166 query,
167 uv.field_name().c_str(),
168 uv.view().content(),
169 uv.view().size());
170 }
171
172 try {
173 query.submit();
174 } catch (std::exception&) {
175 CHECK(error_expected);
176 }
177
178 CHECK(
179 query.query_status() ==
180 (error_expected ? Query::Status::FAILED : Query::Status::COMPLETE));
181
182 // Close array.
183 array->close();
184}
185
186void UpdatesFx::check_update_conditions(
187 std::vector<QueryCondition> qcs,

Callers

nothing calls this directly

Calls 11

TemporalPolicyClass · 0.85
EncryptionAlgorithmClass · 0.85
c_strMethod · 0.80
set_conditionMethod · 0.80
contentMethod · 0.80
viewMethod · 0.80
query_statusMethod · 0.80
field_nameMethod · 0.45
sizeMethod · 0.45
submitMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected