| 237 | } |
| 238 | |
| 239 | int main() { |
| 240 | // Create the context. |
| 241 | Context ctx; |
| 242 | VFS vfs(ctx); |
| 243 | if (vfs.is_dir(array_name)) |
| 244 | vfs.remove_dir(array_name); |
| 245 | |
| 246 | // Create and write data to the array. |
| 247 | create_array(ctx); |
| 248 | write_array(ctx); |
| 249 | |
| 250 | // Printing the entire array. |
| 251 | std::cout << "Printing the entire array...\n"; |
| 252 | read_array_with_qc(ctx, std::nullopt); |
| 253 | std::cout << "\n"; |
| 254 | |
| 255 | // Execute a read query with query condition `a = null`. |
| 256 | std::cout << "Running read query with query condition `a = null`...\n"; |
| 257 | QueryCondition qc(ctx); |
| 258 | qc.init("a", nullptr, 0, TILEDB_EQ); |
| 259 | read_array_with_qc(ctx, qc); |
| 260 | std::cout << "\n"; |
| 261 | |
| 262 | // Execute a read query with query condition `b < "eve"`. |
| 263 | std::cout << "Running read query with query condition `b < \"eve\"`...\n"; |
| 264 | QueryCondition qc1(ctx); |
| 265 | qc1.init("b", "eve", TILEDB_LT); |
| 266 | read_array_with_qc(ctx, qc1); |
| 267 | std::cout << "\n"; |
| 268 | |
| 269 | // Execute a read query with query condition `c >= 1`. |
| 270 | std::cout << "Running read query with query condition `c >= 1`...\n"; |
| 271 | QueryCondition qc2(ctx); |
| 272 | int val = 1; |
| 273 | qc2.init("c", &val, sizeof(int), TILEDB_GE); |
| 274 | read_array_with_qc(ctx, qc2); |
| 275 | std::cout << "\n"; |
| 276 | |
| 277 | // Execute a read query with query condition `3.0f <= d AND d <= 4.0f`. |
| 278 | std::cout << "Running read query with query condition `3.0f <= d AND d <= " |
| 279 | "4.0f`...\n"; |
| 280 | QueryCondition qc3(ctx); |
| 281 | float arr[] = {3.0f, 4.0f}; |
| 282 | qc3.init("d", &arr[0], sizeof(float), TILEDB_GE); |
| 283 | QueryCondition qc4(ctx); |
| 284 | qc4.init("d", &arr[1], sizeof(float), TILEDB_LE); |
| 285 | QueryCondition qc5 = qc3.combine(qc4, TILEDB_AND); |
| 286 | read_array_with_qc(ctx, qc5); |
| 287 | std::cout << "\n"; |
| 288 | |
| 289 | // Execute a read query with query condition `3.0f <= d AND d <= 4.0f AND a != |
| 290 | // null AND b < \"eve\"`. |
| 291 | std::cout << "Running read query with query condition `3.0f <= d AND d <= " |
| 292 | "4.0f AND a != null AND b < \"eve\"`...\n"; |
| 293 | QueryCondition qc6(ctx); |
| 294 | qc6.init("a", nullptr, 0, TILEDB_NE); |
| 295 | qc = qc5.combine(qc6, TILEDB_AND); |
| 296 | qc = qc.combine(qc1, TILEDB_AND); |
nothing calls this directly
no test coverage detected