| 459 | } |
| 460 | |
| 461 | int ArraySchemaFx::array_get_schema_wrapper( |
| 462 | tiledb_array_t* array, tiledb_array_schema_t** array_schema) { |
| 463 | #ifndef TILEDB_SERIALIZATION |
| 464 | return tiledb_array_get_schema(ctx_, array, array_schema); |
| 465 | #endif |
| 466 | |
| 467 | if (!serialize_array_schema_) { |
| 468 | return tiledb_array_get_schema(ctx_, array, array_schema); |
| 469 | } |
| 470 | |
| 471 | int rc = tiledb_array_get_schema(ctx_, array, array_schema); |
| 472 | REQUIRE(rc == TILEDB_OK); |
| 473 | |
| 474 | // Serialize the array |
| 475 | tiledb_buffer_t* buff; |
| 476 | REQUIRE( |
| 477 | tiledb_serialize_array_schema( |
| 478 | ctx_, |
| 479 | *array_schema, |
| 480 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 481 | 1, |
| 482 | &buff) == TILEDB_OK); |
| 483 | |
| 484 | // Load array schema from the rest server |
| 485 | tiledb_array_schema_t* new_array_schema = nullptr; |
| 486 | REQUIRE( |
| 487 | tiledb_deserialize_array_schema( |
| 488 | ctx_, |
| 489 | buff, |
| 490 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 491 | 0, |
| 492 | &new_array_schema) == TILEDB_OK); |
| 493 | |
| 494 | // Serialize the new array schema and deserialize into the original array |
| 495 | // schema. |
| 496 | tiledb_array_schema_free(array_schema); |
| 497 | tiledb_buffer_t* buff2; |
| 498 | REQUIRE( |
| 499 | tiledb_serialize_array_schema( |
| 500 | ctx_, |
| 501 | new_array_schema, |
| 502 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 503 | 0, |
| 504 | &buff2) == TILEDB_OK); |
| 505 | REQUIRE( |
| 506 | tiledb_deserialize_array_schema( |
| 507 | ctx_, |
| 508 | buff2, |
| 509 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 510 | 1, |
| 511 | array_schema) == TILEDB_OK); |
| 512 | |
| 513 | // Clean up. |
| 514 | tiledb_array_schema_free(&new_array_schema); |
| 515 | tiledb_buffer_free(&buff); |
| 516 | tiledb_buffer_free(&buff2); |
| 517 | |
| 518 | return rc; |
nothing calls this directly
no test coverage detected