Skip to content
Snippets Groups Projects
Verified Commit ef5b60b0 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: SELECT for GRPC API

parent 5fd69574
No related branches found
No related tags found
2 merge requests!28Release 0.2.2,!27F grpc select
......@@ -30,6 +30,7 @@ set(test_cases
test_ccaosdb
test_issues
test_user
test_select
)
add_compile_definitions(BUILD_ACM)
......
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
* Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "caosdb/connection.h" // for Connection, ConnectionManager
#include "caosdb/transaction.h" // for Transaction, ResultTable
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl
#include <gtest/gtest_pred_impl.h> // for Test, TestInfo, EXPECT_EQ, TEST
#include <memory> // for allocator, unique_ptr, __shared_p...
//
namespace caosdb::transaction {
/*
* Test select query on empty database.
*/
TEST(test_transaction, test_select) {
const auto &connection = caosdb::connection::ConnectionManager::GetDefaultConnection();
auto query_transaction(connection->CreateTransaction());
query_transaction->Query("SELECT name FROM ENTITY WITH id > 99");
query_transaction->Execute();
EXPECT_EQ(query_transaction->GetResultTable().size(), 0);
EXPECT_EQ(query_transaction->GetResultTable().GetHeader().size(), 1);
for(const auto &column : query_transaction->GetResultTable().GetHeader()) {
EXPECT_EQ(column.GetName(), "name");
}
}
} // namespace caosdb::transaction
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