diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6ea9ee6eaccb31734e0278f8783ad2405911e92..cced2f686368c9f34dae1884140d53958a7e267e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,6 +91,8 @@ test: - cmake -DCMAKE_BUILD_TYPE=Debug .. - cmake --build . -j - cmake --build . -j --target unit_test_coverage + - cmake --build . -j --target cxxcaosdbcli + - cmake --build . -j --target ccaosdbcli # trigger the integration tests trigger_inttest: diff --git a/src/caosdb/unary_rpc_handler.cpp b/src/caosdb/unary_rpc_handler.cpp index f2307549f575f3311a5c096007a1c98b12db1722..14b2971d8b0e693d68f2e9cf35874ba4fd229e86 100644 --- a/src/caosdb/unary_rpc_handler.cpp +++ b/src/caosdb/unary_rpc_handler.cpp @@ -83,6 +83,7 @@ bool UnaryRpcHandler::OnNext(bool ok) { // with the fail-fast option. (Note that async unary RPCs don't post a CQ // tag at this point, nor do client-streaming or bidi-streaming RPCs that // have the initial metadata corked option set.)" + return false; } return true; diff --git a/src/cxxcaosdbcli.cpp b/src/cxxcaosdbcli.cpp index 1760975460281614051c1ac9790be840d7c36c4f..bb089f5a4f117448238c161eb2fc82fb21ed7fdc 100644 --- a/src/cxxcaosdbcli.cpp +++ b/src/cxxcaosdbcli.cpp @@ -26,7 +26,7 @@ #include "caosdb/entity.h" // for Entity #include "caosdb/exceptions.h" // for ConfigurationError #include "caosdb/info.h" // for VersionInfo -#include "caosdb/transaction.h" // for Transaction, UniqueResult, ResultSet +#include "caosdb/transaction.h" // for Transaction, ResultSet #include <iostream> // for operator<<, basic_ostream, basic_ost... #include <memory> // for unique_ptr, allocator, __shared_ptr_... #include <string> // for operator<<, char_traits @@ -50,17 +50,29 @@ auto main() -> int { // retrieve an entity auto transaction(connection->CreateTransaction()); - transaction->RetrieveById("20"); + transaction->RetrieveById("120"); transaction->Execute(); - const auto &result_set = - dynamic_cast<const caosdb::transaction::UniqueResult &>(transaction->GetResultSet()); + const auto &result_set = transaction->GetResultSet(); - // print description - std::cout << "Entity Description: " << result_set.GetEntity().GetDescription() << std::endl; + // print information + const auto &ent = result_set.at(0); + const auto &props = ent.GetProperties(); + std::cout << "Entity Name: " << ent.GetName() << std::endl; + std::cout << "Entity Description: " << ent.GetDescription() << std::endl; + std::cout << "Entity Properties: " << std::endl; + for (const auto &prop : props) { + std::cout << "----------\n" << prop.ToString() << std::endl; + } return 0; } catch (const caosdb::exceptions::ConfigurationError &exc) { std::cout << "ConfigurationError: " << exc.what() << std::endl; return exc.GetCode(); + } catch (const std::exception& exc) { + std::cout << "Exception: " << exc.what() << std::endl; + return 1; + } catch (...) { + std::cout << "Some other exception." << std::endl; + return 2; } }