[2/3] ignite git commit: IGNITE-7855: ODBC: implemented streaming mode. This closes #4669.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9f8d331d/modules/platforms/cpp/odbc-test/src/queries_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp index 471f7d7..cfc3fad 100644 --- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp @@ -69,7 +69,7 @@ struct QueriesTestSuiteFixture : odbc::OdbcTestSuite cache1(0), cache2(0) { -grid = StartTestNode("queries-test.xml", "NodeMain"); +grid = StartPlatformNode("queries-test.xml", "NodeMain"); cache1 = grid.GetCache("cache"); cache2 = grid.GetCache("cache2"); @@ -224,7 +224,7 @@ struct QueriesTestSuiteFixture : odbc::OdbcTestSuite static Ignite StartAdditionalNode(const char* name) { -return StartTestNode("queries-test.xml", name); +return StartPlatformNode("queries-test.xml", name); } /** Node started during the test. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/9f8d331d/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp index 7842704..d8ed087 100644 --- a/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp @@ -87,7 +87,7 @@ struct SqlGetInfoTestSuiteFixture : odbc::OdbcTestSuite */ SqlGetInfoTestSuiteFixture() { -grid = StartTestNode("queries-test.xml", "NodeMain"); +grid = StartPlatformNode("queries-test.xml", "NodeMain"); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/9f8d331d/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp new file mode 100644 index 000..ac2e24d --- /dev/null +++ b/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp @@ -0,0 +1,372 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _MSC_VER +# define BOOST_TEST_DYN_LINK +#endif + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "test_utils.h" + + +using namespace ignite; +using namespace ignite_test; + +using namespace boost::unit_test; + +void CheckNextToken(odbc::SqlLexer& lexer, odbc::TokenType::Type tokenType, const std::string& expected) +{ +BOOST_REQUIRE(!lexer.IsEod()); + +odbc::OdbcExpected hasNext = lexer.Shift(); + +if (!hasNext.IsOk()) +BOOST_FAIL(hasNext.GetError().GetErrorMessage()); + +BOOST_CHECK(*hasNext); + +const odbc::SqlToken& token = lexer.GetCurrentToken(); + +BOOST_REQUIRE(token.GetValue()); +BOOST_CHECK_GT(token.GetSize(), 0); +BOOST_CHECK_EQUAL(token.GetType(), tokenType); +BOOST_CHECK_EQUAL(token.ToString(), expected); +} + +void CheckSetStreamingCommand( +odbc::SqlParser& parser, +bool enabled, +bool allowOverwrite, +int32_t batchSize, +int32_t bufferSizePerNode, +int32_t parallelOperationsPerNode, +int64_t flushFrequency, +bool ordered) +{ +std::auto_ptr cmd = parser.GetNextCommand(); + +BOOST_REQUIRE(cmd.get() != 0); +BOOST_REQUIRE_EQUAL(cmd->GetType(), odbc::SqlCommandType::SET_STREAMING); + +odbc::SqlSetStreamingCommand& cmd0 = static_cast(*cmd); + +BOOST_CHECK_EQUAL(cmd0.IsEnabled(), enabled); +BOOST_CHECK_EQUAL(cmd0.IsAllowOverwrite(), allowOverwrite); +BOOST_CHECK_EQUAL(cmd0.GetBatchSize(), batchSize); +BOOST_CHECK_EQUAL(cmd0.GetBufferSizePerNode(), bufferSizePerNode); +BOOST_CHECK_EQUAL(cmd0.GetParallelOperationsPerNode(), parallelOperationsPerNode); +BOOST_CHECK_EQUAL(cmd0.GetFlushFrequency(), flushFrequency); +BOOST_CHECK_EQUAL(cmd0.IsOrdered(), ordered); +} + +void CheckSingleSetStreamingCommand( +const std::string& sql, +
[2/3] ignite git commit: IGNITE-7855: ODBC: implemented streaming mode. This closes #4669.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a2d867d/modules/platforms/cpp/odbc-test/src/queries_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp index 471f7d7..cfc3fad 100644 --- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp @@ -69,7 +69,7 @@ struct QueriesTestSuiteFixture : odbc::OdbcTestSuite cache1(0), cache2(0) { -grid = StartTestNode("queries-test.xml", "NodeMain"); +grid = StartPlatformNode("queries-test.xml", "NodeMain"); cache1 = grid.GetCache("cache"); cache2 = grid.GetCache("cache2"); @@ -224,7 +224,7 @@ struct QueriesTestSuiteFixture : odbc::OdbcTestSuite static Ignite StartAdditionalNode(const char* name) { -return StartTestNode("queries-test.xml", name); +return StartPlatformNode("queries-test.xml", name); } /** Node started during the test. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/4a2d867d/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp index 7842704..d8ed087 100644 --- a/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/sql_get_info_test.cpp @@ -87,7 +87,7 @@ struct SqlGetInfoTestSuiteFixture : odbc::OdbcTestSuite */ SqlGetInfoTestSuiteFixture() { -grid = StartTestNode("queries-test.xml", "NodeMain"); +grid = StartPlatformNode("queries-test.xml", "NodeMain"); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/4a2d867d/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp -- diff --git a/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp new file mode 100644 index 000..ac2e24d --- /dev/null +++ b/modules/platforms/cpp/odbc-test/src/sql_parsing_test.cpp @@ -0,0 +1,372 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _MSC_VER +# define BOOST_TEST_DYN_LINK +#endif + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "test_utils.h" + + +using namespace ignite; +using namespace ignite_test; + +using namespace boost::unit_test; + +void CheckNextToken(odbc::SqlLexer& lexer, odbc::TokenType::Type tokenType, const std::string& expected) +{ +BOOST_REQUIRE(!lexer.IsEod()); + +odbc::OdbcExpected hasNext = lexer.Shift(); + +if (!hasNext.IsOk()) +BOOST_FAIL(hasNext.GetError().GetErrorMessage()); + +BOOST_CHECK(*hasNext); + +const odbc::SqlToken& token = lexer.GetCurrentToken(); + +BOOST_REQUIRE(token.GetValue()); +BOOST_CHECK_GT(token.GetSize(), 0); +BOOST_CHECK_EQUAL(token.GetType(), tokenType); +BOOST_CHECK_EQUAL(token.ToString(), expected); +} + +void CheckSetStreamingCommand( +odbc::SqlParser& parser, +bool enabled, +bool allowOverwrite, +int32_t batchSize, +int32_t bufferSizePerNode, +int32_t parallelOperationsPerNode, +int64_t flushFrequency, +bool ordered) +{ +std::auto_ptr cmd = parser.GetNextCommand(); + +BOOST_REQUIRE(cmd.get() != 0); +BOOST_REQUIRE_EQUAL(cmd->GetType(), odbc::SqlCommandType::SET_STREAMING); + +odbc::SqlSetStreamingCommand& cmd0 = static_cast(*cmd); + +BOOST_CHECK_EQUAL(cmd0.IsEnabled(), enabled); +BOOST_CHECK_EQUAL(cmd0.IsAllowOverwrite(), allowOverwrite); +BOOST_CHECK_EQUAL(cmd0.GetBatchSize(), batchSize); +BOOST_CHECK_EQUAL(cmd0.GetBufferSizePerNode(), bufferSizePerNode); +BOOST_CHECK_EQUAL(cmd0.GetParallelOperationsPerNode(), parallelOperationsPerNode); +BOOST_CHECK_EQUAL(cmd0.GetFlushFrequency(), flushFrequency); +BOOST_CHECK_EQUAL(cmd0.IsOrdered(), ordered); +} + +void CheckSingleSetStreamingCommand( +const std::string& sql, +