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