Skip to content
Snippets Groups Projects
Commit 481b031c authored by florian's avatar florian
Browse files

DRAFT: Begin implementation of entities

parent 364b9519
No related branches found
No related tags found
3 merge requests!12F consolidation,!9Draft: API: remove UniqueResult, lower-case at, size for ResultSet,!8ENH: Add retrieval and queries to Extern C interface
Pipeline #11657 failed
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
...@@ -375,7 +375,33 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ...@@ -375,7 +375,33 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
result_set->wrapped_result_set); result_set->wrapped_result_set);
auto requested_entity = wrapped_result_set->At(index); auto requested_entity = wrapped_result_set->At(index);
entity->wrapped_entity = (void *)(&requested_entity); entity->wrapped_entity = (void *)(&requested_entity);
// TODO(fspreck) explicit pointers to id, name, ...
return 0;
})
ERROR_RETURN_CODE(GENERIC_ERROR,
int caosdb_transaction_result_set_size(
caosdb_transaction_result_set *result_set, int *out),
{
auto *wrapped_result_set =
static_cast<caosdb::transaction::MultiResultSet *>(
result_set->wrapped_result_set);
int size(wrapped_result_set->Size());
*out = size;
return 0;
})
ERROR_RETURN_CODE(GENERIC_ERROR,
int caosdb_entity_create_entity(caosdb_entity_entity *out), {
auto entity = caosdb::entity::Entity();
out->wrapped_entity = (void *)(&entity);
return 0;
})
ERROR_RETURN_CODE(GENERIC_ERROR,
int caosdb_entity_delete_entity(caosdb_entity_entity *out), {
delete static_cast<caosdb::entity::Entity *>(
out->wrapped_entity);
return 0; return 0;
}) })
} }
...@@ -133,3 +133,13 @@ TEST_F(test_ccaosdb, test_query) { ...@@ -133,3 +133,13 @@ TEST_F(test_ccaosdb, test_query) {
return_code = caosdb_transaction_delete_transaction(&transaction); return_code = caosdb_transaction_delete_transaction(&transaction);
EXPECT_EQ(return_code, 0); EXPECT_EQ(return_code, 0);
} }
TEST_F(test_ccaosdb, test_entity) {
caosdb_entity_entity entity;
int return_code(caosdb_entity_create_entity(&entity));
EXPECT_EQ(return_code, 0);
return_code = caosdb_entity_delete_entity(&entity);
EXPECT_EQ(return_code, 0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment