You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/08/31 06:33:08 UTC
[18/38] ignite git commit: IGNITE-3773: ODBC: Added tests for UUID
data type. This closes #993.
IGNITE-3773: ODBC: Added tests for UUID data type. This closes #993.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28917034
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28917034
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28917034
Branch: refs/heads/ignite-3443
Commit: 289170346e40a89243b80d3743c1b66543a117ef
Parents: b575764
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Aug 29 15:00:08 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Aug 29 15:00:08 2016 +0300
----------------------------------------------------------------------
.../processors/odbc/escape/OdbcEscapeUtils.java | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 5 +-
.../platforms/cpp/odbc-test/include/Makefile.am | 2 +-
.../include/sql_function_test_suite_fixture.h | 188 -------------
.../odbc-test/include/sql_test_suite_fixture.h | 191 +++++++++++++
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 7 +-
.../project/vs/odbc-test.vcxproj.filters | 13 +-
.../src/sql_aggregate_functions_test.cpp | 4 +-
.../src/sql_function_test_suite_fixture.cpp | 252 -----------------
.../src/sql_numeric_functions_test.cpp | 4 +-
.../cpp/odbc-test/src/sql_operators_test.cpp | 4 +-
.../odbc-test/src/sql_string_functions_test.cpp | 4 +-
.../odbc-test/src/sql_system_functions_test.cpp | 4 +-
.../odbc-test/src/sql_test_suite_fixture.cpp | 271 +++++++++++++++++++
.../cpp/odbc-test/src/sql_types_test.cpp | 60 ++++
.../cpp/odbc-test/src/sql_value_expressions.cpp | 94 -------
.../src/sql_value_expressions_test.cpp | 94 +++++++
17 files changed, 643 insertions(+), 556 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
index 4c1deb6..a4b89c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
@@ -291,7 +291,7 @@ public class OdbcEscapeUtils {
if (!pattern.matcher(val).matches())
throw new IgniteException("Invalid " + type + " escape sequence: " + substring(text, startPos, len));
- return val;
+ return "CAST(" + val + " AS UUID)";
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index a3f954e..de8fb5d 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -62,13 +62,14 @@ ignite_odbc_tests_SOURCES = \
src/utility_test.cpp \
src/queries_test.cpp \
src/test_utils.cpp \
- src/sql_function_test_suite_fixture.cpp \
+ src/sql_test_suite_fixture.cpp \
src/sql_string_functions_test.cpp \
src/sql_numeric_functions_test.cpp \
src/sql_aggregate_functions_test.cpp \
src/sql_system_functions_test.cpp \
src/sql_operators_test.cpp \
- src/sql_value_expressions.cpp \
+ src/sql_value_expressions_test.cpp \
+ src/sql_types_test.cpp \
../odbc/src/cursor.cpp \
../odbc/src/config/connection_info.cpp \
../odbc/src/app/application_data_buffer.cpp \
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/Makefile.am b/modules/platforms/cpp/odbc-test/include/Makefile.am
index baca1b7..832103c 100644
--- a/modules/platforms/cpp/odbc-test/include/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/include/Makefile.am
@@ -21,5 +21,5 @@ noinst_HEADERS = \
teamcity/teamcity_messages.h \
test_type.h \
test_utils.h \
- sql_function_test_suite_fixture.h
+ sql_test_suite_fixture.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/include/sql_function_test_suite_fixture.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/sql_function_test_suite_fixture.h b/modules/platforms/cpp/odbc-test/include/sql_function_test_suite_fixture.h
deleted file mode 100644
index 57c3f0f..0000000
--- a/modules/platforms/cpp/odbc-test/include/sql_function_test_suite_fixture.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 _IGNITE_ODBC_TEST_SQL_FUNCTION_TEST_FIXTURE
-#define _IGNITE_ODBC_TEST_SQL_FUNCTION_TEST_FIXTURE
-
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-#include <sql.h>
-#include <sqlext.h>
-
-#include <string>
-
-#ifndef _MSC_VER
-# define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/ignite.h"
-#include "ignite/ignition.h"
-
-#include "test_type.h"
-
-namespace ignite
-{
- /**
- * Test setup fixture.
- */
- struct SqlFunctionTestSuiteFixture
- {
- /**
- * Constructor.
- */
- SqlFunctionTestSuiteFixture();
-
- /**
- * Destructor.
- */
- ~SqlFunctionTestSuiteFixture();
-
- /**
- * Run query returning single result and stores it to buffer.
- *
- * @param request SQL request.
- * @param type Result type.
- * @param column Result buffer.
- * @param bufSize Result buffer size.
- * @param resSize Size of received value.
- */
- void CheckSingleResult0(const char* request, SQLSMALLINT type,
- void* column, SQLLEN bufSize, SQLLEN* resSize) const;
-
- /**
- * Run query returning single result and check it to be equal to expected.
- *
- * @param request SQL request.
- * @param expected Expected result.
- */
- template<typename T>
- void CheckSingleResult(const char* request, const T& expected)
- {
- BOOST_FAIL("Function is not defined for the type.");
- }
-
- /**
- * Run query returning single result and check it to be successful.
- *
- * @param request SQL request.
- */
- template<typename T>
- void CheckSingleResult(const char* request)
- {
- BOOST_FAIL("Function is not defined for the type.");
- }
-
- /**
- * Run query returning single result and check it to be equal to expected.
- *
- * @param request SQL request.
- * @param expected Expected result.
- * @param type Result type.
- */
- template<typename T>
- void CheckSingleResultNum0(const char* request, const T& expected, SQLSMALLINT type)
- {
- T res = 0;
-
- CheckSingleResult0(request, type, &res, 0, 0);
-
- BOOST_CHECK_EQUAL(res, expected);
- }
-
- /**
- * Run query returning single result and check it to be equal to expected.
- *
- * @param request SQL request.
- * @param expected Expected result.
- * @param type Result type.
- */
- template<typename T>
- void CheckSingleResultNum0(const char* request, SQLSMALLINT type)
- {
- T res = 0;
-
- CheckSingleResult0(request, type, &res, 0, 0);
- }
-
-
- /** Node started during the test. */
- Ignite grid;
-
- /** Test cache instance. */
- cache::Cache<int64_t, TestType> testCache;
-
- /** ODBC Environment. */
- SQLHENV env;
-
- /** ODBC Connect. */
- SQLHDBC dbc;
-
- /** ODBC Statement. */
- SQLHSTMT stmt;
- };
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<std::string>(const char* request, const std::string& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int64_t>(const char* request, const int64_t& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int32_t>(const char* request, const int32_t& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int16_t>(const char* request, const int16_t& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int8_t>(const char* request, const int8_t& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<float>(const char* request, const float& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<double>(const char* request, const double& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<bool>(const char* request, const bool& expected);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<std::string>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int64_t>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int32_t>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int16_t>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int8_t>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<float>(const char* request);
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<double>(const char* request);
-}
-
-#endif //_IGNITE_ODBC_TEST_SQL_FUNCTION_TEST_FIXTURE
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
new file mode 100644
index 0000000..9e482da
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
@@ -0,0 +1,191 @@
+/*
+ * 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 _IGNITE_ODBC_TEST_SQL_TEST_SUIT_FIXTURE
+#define _IGNITE_ODBC_TEST_SQL_TEST_SUIT_FIXTURE
+
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqlext.h>
+
+#include <string>
+
+#ifndef _MSC_VER
+# define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+#include "test_type.h"
+
+namespace ignite
+{
+ /**
+ * Test setup fixture.
+ */
+ struct SqlTestSuiteFixture
+ {
+ /**
+ * Constructor.
+ */
+ SqlTestSuiteFixture();
+
+ /**
+ * Destructor.
+ */
+ ~SqlTestSuiteFixture();
+
+ /**
+ * Run query returning single result and stores it to buffer.
+ *
+ * @param request SQL request.
+ * @param type Result type.
+ * @param column Result buffer.
+ * @param bufSize Result buffer size.
+ * @param resSize Size of received value.
+ */
+ void CheckSingleResult0(const char* request, SQLSMALLINT type,
+ void* column, SQLLEN bufSize, SQLLEN* resSize) const;
+
+ /**
+ * Run query returning single result and check it to be equal to expected.
+ *
+ * @param request SQL request.
+ * @param expected Expected result.
+ */
+ template<typename T>
+ void CheckSingleResult(const char* request, const T& expected)
+ {
+ BOOST_FAIL("Function is not defined for the type.");
+ }
+
+ /**
+ * Run query returning single result and check it to be successful.
+ *
+ * @param request SQL request.
+ */
+ template<typename T>
+ void CheckSingleResult(const char* request)
+ {
+ BOOST_FAIL("Function is not defined for the type.");
+ }
+
+ /**
+ * Run query returning single result and check it to be equal to expected.
+ *
+ * @param request SQL request.
+ * @param expected Expected result.
+ * @param type Result type.
+ */
+ template<typename T>
+ void CheckSingleResultNum0(const char* request, const T& expected, SQLSMALLINT type)
+ {
+ T res = 0;
+
+ CheckSingleResult0(request, type, &res, 0, 0);
+
+ BOOST_CHECK_EQUAL(res, expected);
+ }
+
+ /**
+ * Run query returning single result and check it to be equal to expected.
+ *
+ * @param request SQL request.
+ * @param expected Expected result.
+ * @param type Result type.
+ */
+ template<typename T>
+ void CheckSingleResultNum0(const char* request, SQLSMALLINT type)
+ {
+ T res = 0;
+
+ CheckSingleResult0(request, type, &res, 0, 0);
+ }
+
+
+ /** Node started during the test. */
+ Ignite grid;
+
+ /** Test cache instance. */
+ cache::Cache<int64_t, TestType> testCache;
+
+ /** ODBC Environment. */
+ SQLHENV env;
+
+ /** ODBC Connect. */
+ SQLHDBC dbc;
+
+ /** ODBC Statement. */
+ SQLHSTMT stmt;
+ };
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<std::string>(const char* request, const std::string& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int64_t>(const char* request, const int64_t& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int32_t>(const char* request, const int32_t& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int16_t>(const char* request, const int16_t& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int8_t>(const char* request, const int8_t& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request, const float& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<double>(const char* request, const double& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<bool>(const char* request, const bool& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<ignite::Guid>(const char* request, const ignite::Guid& expected);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<std::string>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int64_t>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int32_t>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int16_t>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int8_t>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request);
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<double>(const char* request);
+}
+
+#endif //_IGNITE_ODBC_TEST_SQL_TEST_SUIT_FIXTURE
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index 8b4bee6..a9423ca 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -169,19 +169,20 @@
<ClCompile Include="..\..\src\parser_test.cpp" />
<ClCompile Include="..\..\src\row_test.cpp" />
<ClCompile Include="..\..\src\sql_aggregate_functions_test.cpp" />
- <ClCompile Include="..\..\src\sql_function_test_suite_fixture.cpp" />
+ <ClCompile Include="..\..\src\sql_test_suite_fixture.cpp" />
<ClCompile Include="..\..\src\sql_numeric_functions_test.cpp" />
<ClCompile Include="..\..\src\sql_operators_test.cpp" />
<ClCompile Include="..\..\src\sql_string_functions_test.cpp" />
<ClCompile Include="..\..\src\sql_system_functions_test.cpp" />
- <ClCompile Include="..\..\src\sql_value_expressions.cpp" />
+ <ClCompile Include="..\..\src\sql_types_test.cpp" />
+ <ClCompile Include="..\..\src\sql_value_expressions_test.cpp" />
<ClCompile Include="..\..\src\teamcity\teamcity_boost.cpp" />
<ClCompile Include="..\..\src\teamcity\teamcity_messages.cpp" />
<ClCompile Include="..\..\src\test_utils.cpp" />
<ClCompile Include="..\..\src\utility_test.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\..\include\sql_function_test_suite_fixture.h" />
+ <ClInclude Include="..\..\include\sql_test_suite_fixture.h" />
<ClInclude Include="..\..\include\teamcity\teamcity_messages.h" />
<ClInclude Include="..\..\include\test_type.h" />
<ClInclude Include="..\..\include\test_utils.h" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
index 4756f83..84f5a29 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
@@ -85,9 +85,6 @@
<ClCompile Include="..\..\src\sql_numeric_functions_test.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\sql_function_test_suite_fixture.cpp">
- <Filter>Code</Filter>
- </ClCompile>
<ClCompile Include="..\..\src\sql_aggregate_functions_test.cpp">
<Filter>Code</Filter>
</ClCompile>
@@ -97,7 +94,13 @@
<ClCompile Include="..\..\src\sql_operators_test.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\sql_value_expressions.cpp">
+ <ClCompile Include="..\..\src\sql_types_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\sql_test_suite_fixture.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\sql_value_expressions_test.cpp">
<Filter>Code</Filter>
</ClCompile>
</ItemGroup>
@@ -111,7 +114,7 @@
<ClInclude Include="..\..\include\test_utils.h">
<Filter>Code</Filter>
</ClInclude>
- <ClInclude Include="..\..\include\sql_function_test_suite_fixture.h">
+ <ClInclude Include="..\..\include\sql_test_suite_fixture.h">
<Filter>Code</Filter>
</ClInclude>
</ItemGroup>
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
index 6254913..3fa4d97 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
@@ -41,7 +41,7 @@
#include "test_type.h"
#include "test_utils.h"
-#include "sql_function_test_suite_fixture.h"
+#include "sql_test_suite_fixture.h"
using namespace ignite;
using namespace ignite::cache;
@@ -52,7 +52,7 @@ using namespace boost::unit_test;
using ignite::impl::binary::BinaryUtils;
-BOOST_FIXTURE_TEST_SUITE(SqlAggregateFunctionTestSuite, ignite::SqlFunctionTestSuiteFixture)
+BOOST_FIXTURE_TEST_SUITE(SqlAggregateFunctionTestSuite, ignite::SqlTestSuiteFixture)
BOOST_AUTO_TEST_CASE(TestAggregateFunctionAvgInt)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_function_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_function_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_function_test_suite_fixture.cpp
deleted file mode 100644
index d6b175f..0000000
--- a/modules/platforms/cpp/odbc-test/src/sql_function_test_suite_fixture.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * 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.
- */
-
-#include "sql_function_test_suite_fixture.h"
-
-#include "test_utils.h"
-
-namespace ignite
-{
- SqlFunctionTestSuiteFixture::SqlFunctionTestSuiteFixture():
- testCache(0),
- env(NULL),
- dbc(NULL),
- stmt(NULL)
- {
- IgniteConfiguration cfg;
-
- cfg.jvmOpts.push_back("-Xdebug");
- cfg.jvmOpts.push_back("-Xnoagent");
- cfg.jvmOpts.push_back("-Djava.compiler=NONE");
- cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
- cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
- cfg.jvmInitMem = 256;
- cfg.jvmMaxMem = 768;
-#else
- cfg.jvmInitMem = 1024;
- cfg.jvmMaxMem = 4096;
-#endif
-
- char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
-
- BOOST_REQUIRE(cfgPath != 0) ;
-
- cfg.springCfgPath.assign(cfgPath).append("/queries-test.xml");
-
- IgniteError err;
-
- grid = Ignition::Start(cfg, &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_FAIL(err.GetText()) ;
-
- testCache = grid.GetCache<int64_t, TestType>("cache");
-
- // Allocate an environment handle
- SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
-
- BOOST_REQUIRE(env != NULL) ;
-
- // We want ODBC 3 support
- SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC3), 0);
-
- // Allocate a connection handle
- SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
-
- BOOST_REQUIRE(dbc != NULL) ;
-
- // Connect string
- SQLCHAR connectStr[] = "DRIVER={Apache Ignite};SERVER=localhost;PORT=10800;CACHE=cache";
-
- SQLCHAR outstr[ODBC_BUFFER_SIZE];
- SQLSMALLINT outstrlen;
-
- // Connecting to ODBC server.
- SQLRETURN ret = SQLDriverConnect(dbc, NULL, connectStr, static_cast<SQLSMALLINT>(sizeof(connectStr)),
- outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE);
-
- if (!SQL_SUCCEEDED(ret))
- {
- Ignition::Stop(grid.GetName(), true);
-
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_DBC, dbc)) ;
- }
-
- // Allocate a statement handle
- SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
-
- BOOST_REQUIRE(stmt != NULL) ;
- }
-
- SqlFunctionTestSuiteFixture::~SqlFunctionTestSuiteFixture()
- {
- // Releasing statement handle.
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-
- // Disconneting from the server.
- SQLDisconnect(dbc);
-
- // Releasing allocated handles.
- SQLFreeHandle(SQL_HANDLE_DBC, dbc);
- SQLFreeHandle(SQL_HANDLE_ENV, env);
-
- ignite::Ignition::Stop(grid.GetName(), true);
- }
-
- void SqlFunctionTestSuiteFixture::CheckSingleResult0(const char* request,
- SQLSMALLINT type, void* column, SQLLEN bufSize, SQLLEN* resSize) const
- {
- SQLRETURN ret;
-
- ret = SQLBindCol(stmt, 1, type, column, bufSize, resSize);
-
- if (!SQL_SUCCEEDED(ret))
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
-
- ret = SQLExecDirect(stmt, reinterpret_cast<SQLCHAR*>(const_cast<char*>(request)), SQL_NTS);
- if (!SQL_SUCCEEDED(ret))
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
-
- ret = SQLFetch(stmt);
- if (!SQL_SUCCEEDED(ret))
- BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
-
- ret = SQLFetch(stmt);
- BOOST_CHECK(ret == SQL_NO_DATA) ;
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<std::string>(const char* request, const std::string& expected)
- {
- SQLCHAR res[ODBC_BUFFER_SIZE] = { 0 };
- SQLLEN resLen = 0;
-
- CheckSingleResult0(request, SQL_C_CHAR, res, ODBC_BUFFER_SIZE, &resLen);
-
- std::string actual;
-
- if (resLen > 0)
- actual.assign(reinterpret_cast<char*>(res), static_cast<size_t>(resLen));
-
- BOOST_CHECK_EQUAL(actual, expected);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int64_t>(const char* request, const int64_t& expected)
- {
- CheckSingleResultNum0<int64_t>(request, expected, SQL_C_SBIGINT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int32_t>(const char* request, const int32_t& expected)
- {
- CheckSingleResultNum0<int32_t>(request, expected, SQL_C_SLONG);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int16_t>(const char* request, const int16_t& expected)
- {
- CheckSingleResultNum0<int16_t>(request, expected, SQL_C_SSHORT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int8_t>(const char* request, const int8_t& expected)
- {
- CheckSingleResultNum0<int8_t>(request, expected, SQL_C_STINYINT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<float>(const char* request, const float& expected)
- {
- SQLFLOAT res = 0;
-
- CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
-
- BOOST_CHECK_CLOSE(static_cast<float>(res), expected, 1E-6f);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<double>(const char* request, const double& expected)
- {
- SQLDOUBLE res = 0;
-
- CheckSingleResult0(request, SQL_C_DOUBLE, &res, 0, 0);
-
- BOOST_CHECK_CLOSE(static_cast<double>(res), expected, 1E-6);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<bool>(const char* request, const bool& expected)
- {
- SQLCHAR res = 0;
-
- CheckSingleResult0(request, SQL_C_BIT, &res, 0, 0);
-
- BOOST_CHECK_EQUAL((res != 0), expected);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<std::string>(const char* request)
- {
- SQLCHAR res[ODBC_BUFFER_SIZE] = { 0 };
- SQLLEN resLen = 0;
-
- CheckSingleResult0(request, SQL_C_CHAR, res, ODBC_BUFFER_SIZE, &resLen);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int64_t>(const char* request)
- {
- CheckSingleResultNum0<int64_t>(request, SQL_C_SBIGINT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int32_t>(const char* request)
- {
- CheckSingleResultNum0<int32_t>(request, SQL_C_SLONG);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int16_t>(const char* request)
- {
- CheckSingleResultNum0<int16_t>(request, SQL_C_SSHORT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<int8_t>(const char* request)
- {
- CheckSingleResultNum0<int8_t>(request, SQL_C_STINYINT);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<float>(const char* request)
- {
- SQLFLOAT res = 0;
-
- CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
- }
-
- template<>
- void SqlFunctionTestSuiteFixture::CheckSingleResult<double>(const char* request)
- {
- SQLDOUBLE res = 0;
-
- CheckSingleResult0(request, SQL_C_DOUBLE, &res, 0, 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
index 80ffd83..e16d8c1 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
@@ -41,7 +41,7 @@
#include "test_type.h"
#include "test_utils.h"
-#include "sql_function_test_suite_fixture.h"
+#include "sql_test_suite_fixture.h"
using namespace ignite;
using namespace ignite::cache;
@@ -52,7 +52,7 @@ using namespace boost::unit_test;
using ignite::impl::binary::BinaryUtils;
-BOOST_FIXTURE_TEST_SUITE(SqlNumericFunctionTestSuite, ignite::SqlFunctionTestSuiteFixture)
+BOOST_FIXTURE_TEST_SUITE(SqlNumericFunctionTestSuite, ignite::SqlTestSuiteFixture)
BOOST_AUTO_TEST_CASE(TestNumericFunctionAbs)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_operators_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_operators_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_operators_test.cpp
index db3d3f7..de884ca 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_operators_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_operators_test.cpp
@@ -29,12 +29,12 @@
#include <boost/test/unit_test.hpp>
#include "test_type.h"
-#include "sql_function_test_suite_fixture.h"
+#include "sql_test_suite_fixture.h"
#include <ignite/common/decimal.h>
using namespace ignite;
-BOOST_FIXTURE_TEST_SUITE(SqlOperatorTestSuite, ignite::SqlFunctionTestSuiteFixture)
+BOOST_FIXTURE_TEST_SUITE(SqlOperatorTestSuite, ignite::SqlTestSuiteFixture)
BOOST_AUTO_TEST_CASE(TestOperatorAddInt)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
index d22bb83..d1ce194 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
@@ -37,7 +37,7 @@
#include "test_type.h"
#include "test_utils.h"
-#include "sql_function_test_suite_fixture.h"
+#include "sql_test_suite_fixture.h"
using namespace ignite;
using namespace ignite::cache;
@@ -48,7 +48,7 @@ using namespace boost::unit_test;
using ignite::impl::binary::BinaryUtils;
-BOOST_FIXTURE_TEST_SUITE(SqlStringFunctionTestSuite, ignite::SqlFunctionTestSuiteFixture)
+BOOST_FIXTURE_TEST_SUITE(SqlStringFunctionTestSuite, ignite::SqlTestSuiteFixture)
BOOST_AUTO_TEST_CASE(TestStringFunctionAscii)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_system_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_system_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_system_functions_test.cpp
index 752925d..30fa036 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_system_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_system_functions_test.cpp
@@ -21,13 +21,13 @@
#include <boost/test/unit_test.hpp>
-#include "sql_function_test_suite_fixture.h"
+#include "sql_test_suite_fixture.h"
using namespace ignite;
using namespace boost::unit_test;
-BOOST_FIXTURE_TEST_SUITE(SqlSystemFunctionTestSuite, ignite::SqlFunctionTestSuiteFixture)
+BOOST_FIXTURE_TEST_SUITE(SqlSystemFunctionTestSuite, ignite::SqlTestSuiteFixture)
BOOST_AUTO_TEST_CASE(TestSystemFunctionDatabase)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
new file mode 100644
index 0000000..16e5ea0
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -0,0 +1,271 @@
+/*
+ * 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.
+ */
+
+#include "sql_test_suite_fixture.h"
+
+#include "test_utils.h"
+
+namespace ignite
+{
+ SqlTestSuiteFixture::SqlTestSuiteFixture():
+ testCache(0),
+ env(NULL),
+ dbc(NULL),
+ stmt(NULL)
+ {
+ IgniteConfiguration cfg;
+
+ cfg.jvmOpts.push_back("-Xdebug");
+ cfg.jvmOpts.push_back("-Xnoagent");
+ cfg.jvmOpts.push_back("-Djava.compiler=NONE");
+ cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+ cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+
+#ifdef IGNITE_TESTS_32
+ cfg.jvmInitMem = 256;
+ cfg.jvmMaxMem = 768;
+#else
+ cfg.jvmInitMem = 1024;
+ cfg.jvmMaxMem = 4096;
+#endif
+
+ char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
+
+ BOOST_REQUIRE(cfgPath != 0) ;
+
+ cfg.springCfgPath.assign(cfgPath).append("/queries-test.xml");
+
+ IgniteError err;
+
+ grid = Ignition::Start(cfg, &err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ BOOST_FAIL(err.GetText()) ;
+
+ testCache = grid.GetCache<int64_t, TestType>("cache");
+
+ // Allocate an environment handle
+ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+ BOOST_REQUIRE(env != NULL) ;
+
+ // We want ODBC 3 support
+ SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC3), 0);
+
+ // Allocate a connection handle
+ SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
+
+ BOOST_REQUIRE(dbc != NULL) ;
+
+ // Connect string
+ SQLCHAR connectStr[] = "DRIVER={Apache Ignite};SERVER=localhost;PORT=10800;CACHE=cache";
+
+ SQLCHAR outstr[ODBC_BUFFER_SIZE];
+ SQLSMALLINT outstrlen;
+
+ // Connecting to ODBC server.
+ SQLRETURN ret = SQLDriverConnect(dbc, NULL, connectStr, static_cast<SQLSMALLINT>(sizeof(connectStr)),
+ outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE);
+
+ if (!SQL_SUCCEEDED(ret))
+ {
+ Ignition::Stop(grid.GetName(), true);
+
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_DBC, dbc)) ;
+ }
+
+ // Allocate a statement handle
+ SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
+
+ BOOST_REQUIRE(stmt != NULL) ;
+ }
+
+ SqlTestSuiteFixture::~SqlTestSuiteFixture()
+ {
+ // Releasing statement handle.
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+
+ // Disconneting from the server.
+ SQLDisconnect(dbc);
+
+ // Releasing allocated handles.
+ SQLFreeHandle(SQL_HANDLE_DBC, dbc);
+ SQLFreeHandle(SQL_HANDLE_ENV, env);
+
+ ignite::Ignition::Stop(grid.GetName(), true);
+ }
+
+ void SqlTestSuiteFixture::CheckSingleResult0(const char* request,
+ SQLSMALLINT type, void* column, SQLLEN bufSize, SQLLEN* resSize) const
+ {
+ SQLRETURN ret;
+
+ ret = SQLBindCol(stmt, 1, type, column, bufSize, resSize);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+
+ ret = SQLExecDirect(stmt, reinterpret_cast<SQLCHAR*>(const_cast<char*>(request)), SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+
+ ret = SQLFetch(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+
+ ret = SQLFetch(stmt);
+ BOOST_CHECK(ret == SQL_NO_DATA) ;
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<std::string>(const char* request, const std::string& expected)
+ {
+ SQLCHAR res[ODBC_BUFFER_SIZE] = { 0 };
+ SQLLEN resLen = 0;
+
+ CheckSingleResult0(request, SQL_C_CHAR, res, ODBC_BUFFER_SIZE, &resLen);
+
+ std::string actual;
+
+ if (resLen > 0)
+ actual.assign(reinterpret_cast<char*>(res), static_cast<size_t>(resLen));
+
+ BOOST_CHECK_EQUAL(actual, expected);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int64_t>(const char* request, const int64_t& expected)
+ {
+ CheckSingleResultNum0<int64_t>(request, expected, SQL_C_SBIGINT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int32_t>(const char* request, const int32_t& expected)
+ {
+ CheckSingleResultNum0<int32_t>(request, expected, SQL_C_SLONG);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int16_t>(const char* request, const int16_t& expected)
+ {
+ CheckSingleResultNum0<int16_t>(request, expected, SQL_C_SSHORT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int8_t>(const char* request, const int8_t& expected)
+ {
+ CheckSingleResultNum0<int8_t>(request, expected, SQL_C_STINYINT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request, const float& expected)
+ {
+ SQLFLOAT res = 0;
+
+ CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
+
+ BOOST_CHECK_CLOSE(static_cast<float>(res), expected, 1E-6f);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<double>(const char* request, const double& expected)
+ {
+ SQLDOUBLE res = 0;
+
+ CheckSingleResult0(request, SQL_C_DOUBLE, &res, 0, 0);
+
+ BOOST_CHECK_CLOSE(static_cast<double>(res), expected, 1E-6);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<bool>(const char* request, const bool& expected)
+ {
+ SQLCHAR res = 0;
+
+ CheckSingleResult0(request, SQL_C_BIT, &res, 0, 0);
+
+ BOOST_CHECK_EQUAL((res != 0), expected);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<ignite::Guid>(const char* request, const ignite::Guid& expected)
+ {
+ SQLGUID res;
+
+ memset(&res, 0, sizeof(res));
+
+ CheckSingleResult0(request, SQL_C_GUID, &res, 0, 0);
+
+ BOOST_CHECK_EQUAL(res.Data1, expected.GetMostSignificantBits() & 0xFFFFFFFF00000000ULL >> 32);
+ BOOST_CHECK_EQUAL(res.Data2, expected.GetMostSignificantBits() & 0x00000000FFFF0000ULL >> 16);
+ BOOST_CHECK_EQUAL(res.Data3, expected.GetMostSignificantBits() & 0x000000000000FFFFULL);
+
+ for (int i = 0; i < sizeof(res.Data4); ++i)
+ BOOST_CHECK_EQUAL(res.Data4[i], (expected.GetLeastSignificantBits() & (0xFFULL << (8 * i))) >> (8 * i));
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<std::string>(const char* request)
+ {
+ SQLCHAR res[ODBC_BUFFER_SIZE] = { 0 };
+ SQLLEN resLen = 0;
+
+ CheckSingleResult0(request, SQL_C_CHAR, res, ODBC_BUFFER_SIZE, &resLen);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int64_t>(const char* request)
+ {
+ CheckSingleResultNum0<int64_t>(request, SQL_C_SBIGINT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int32_t>(const char* request)
+ {
+ CheckSingleResultNum0<int32_t>(request, SQL_C_SLONG);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int16_t>(const char* request)
+ {
+ CheckSingleResultNum0<int16_t>(request, SQL_C_SSHORT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<int8_t>(const char* request)
+ {
+ CheckSingleResultNum0<int8_t>(request, SQL_C_STINYINT);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<float>(const char* request)
+ {
+ SQLFLOAT res = 0;
+
+ CheckSingleResult0(request, SQL_C_FLOAT, &res, 0, 0);
+ }
+
+ template<>
+ void SqlTestSuiteFixture::CheckSingleResult<double>(const char* request)
+ {
+ SQLDOUBLE res = 0;
+
+ CheckSingleResult0(request, SQL_C_DOUBLE, &res, 0, 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
new file mode 100644
index 0000000..ccbb917
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
@@ -0,0 +1,60 @@
+/*
+ * 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 <boost/test/unit_test.hpp>
+
+#include "sql_test_suite_fixture.h"
+
+using namespace ignite;
+
+using namespace boost::unit_test;
+
+BOOST_FIXTURE_TEST_SUITE(SqlTypesTestSuite, ignite::SqlTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(TestGuidTrivial)
+{
+ CheckSingleResult<std::string>("SELECT {guid '04CC382A-0B82-F520-08D0-07A0620C0004'}",
+ "04cc382a-0b82-f520-08d0-07a0620c0004");
+
+ CheckSingleResult<std::string>("SELECT {guid '63802467-9f4a-4f71-8fc8-cf2d99a28ddf'}",
+ "63802467-9f4a-4f71-8fc8-cf2d99a28ddf");
+}
+
+BOOST_AUTO_TEST_CASE(TestGuidEqualsToColumn)
+{
+ TestType in1;
+ TestType in2;
+
+ in1.guidField = Guid(0x638024679f4a4f71, 0x8fc8cf2d99a28ddf);
+ in2.guidField = Guid(0x04cc382a0b82f520, 0x08d007a0620c0004);
+
+ in1.i32Field = 1;
+ in2.i32Field = 2;
+
+ testCache.Put(1, in1);
+ testCache.Put(2, in2);
+
+ CheckSingleResult<int32_t>(
+ "SELECT i32Field FROM TestType WHERE guidField = {guid '04cc382a-0b82-f520-08d0-07a0620c0004'}", in2.i32Field);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_value_expressions.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_value_expressions.cpp b/modules/platforms/cpp/odbc-test/src/sql_value_expressions.cpp
deleted file mode 100644
index e7d6598..0000000
--- a/modules/platforms/cpp/odbc-test/src/sql_value_expressions.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 <boost/test/unit_test.hpp>
-
-#include "sql_function_test_suite_fixture.h"
-
-using namespace ignite;
-
-using namespace boost::unit_test;
-
-BOOST_FIXTURE_TEST_SUITE(SqlValueExpressionTestSuite, ignite::SqlFunctionTestSuiteFixture)
-
-BOOST_AUTO_TEST_CASE(TestCase)
-{
- TestType in;
-
- in.i32Field = 82;
-
- testCache.Put(1, in);
-
- CheckSingleResult<int32_t>(
- "SELECT "
- "CASE i32Field WHEN 82 "
- "THEN (i32Field / 2) "
- "ELSE (i32Field / 3) "
- "END "
- "FROM TestType", in.i32Field / 2);
-
-
- CheckSingleResult<int32_t>(
- "SELECT "
- "CASE i32Field WHEN 22 "
- "THEN (i32Field / 2) "
- "ELSE (i32Field / 3) "
- "END "
- "FROM TestType", in.i32Field / 3);;
-}
-
-BOOST_AUTO_TEST_CASE(TestCast)
-{
- TestType in;
-
- in.i32Field = 12345;
- in.strField = "54321";
-
- testCache.Put(1, in);
-
- CheckSingleResult<int32_t>("SELECT CAST(strField AS INT) + i32Field FROM TestType",
- common::LexicalCast<int32_t>(in.strField) + in.i32Field);
-
- CheckSingleResult<std::string>("SELECT CAST(i32Field AS VARCHAR) || strField FROM TestType",
- common::LexicalCast<std::string>(in.i32Field) + in.strField);
-}
-
-BOOST_AUTO_TEST_CASE(TestCoalesce)
-{
- CheckSingleResult<std::string>("SELECT COALESCE('One', 'Two', 'Three')", "One");
- CheckSingleResult<std::string>("SELECT COALESCE(NULL, 'Two', 'Three')", "Two");
- CheckSingleResult<std::string>("SELECT COALESCE(NULL, 'Two', NULL)", "Two");
- CheckSingleResult<std::string>("SELECT COALESCE(NULL, NULL, 'Three')", "Three");
-}
-
-BOOST_AUTO_TEST_CASE(TestNullif)
-{
- TestType in;
-
- in.strField = "SomeValue";
-
- testCache.Put(1, in);
-
- CheckSingleResult<std::string>("SELECT NULLIF(strField, 'blablabla') FROM TestType", in.strField);
- CheckSingleResult<std::string>("SELECT NULLIF(strField, 'SomeValue') FROM TestType", "");
-}
-
-BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/28917034/modules/platforms/cpp/odbc-test/src/sql_value_expressions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_value_expressions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_value_expressions_test.cpp
new file mode 100644
index 0000000..eb9b6ea
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_value_expressions_test.cpp
@@ -0,0 +1,94 @@
+/*
+ * 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 <boost/test/unit_test.hpp>
+
+#include "sql_test_suite_fixture.h"
+
+using namespace ignite;
+
+using namespace boost::unit_test;
+
+BOOST_FIXTURE_TEST_SUITE(SqlValueExpressionTestSuite, ignite::SqlTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(TestCase)
+{
+ TestType in;
+
+ in.i32Field = 82;
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<int32_t>(
+ "SELECT "
+ "CASE i32Field WHEN 82 "
+ "THEN (i32Field / 2) "
+ "ELSE (i32Field / 3) "
+ "END "
+ "FROM TestType", in.i32Field / 2);
+
+
+ CheckSingleResult<int32_t>(
+ "SELECT "
+ "CASE i32Field WHEN 22 "
+ "THEN (i32Field / 2) "
+ "ELSE (i32Field / 3) "
+ "END "
+ "FROM TestType", in.i32Field / 3);;
+}
+
+BOOST_AUTO_TEST_CASE(TestCast)
+{
+ TestType in;
+
+ in.i32Field = 12345;
+ in.strField = "54321";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<int32_t>("SELECT CAST(strField AS INT) + i32Field FROM TestType",
+ common::LexicalCast<int32_t>(in.strField) + in.i32Field);
+
+ CheckSingleResult<std::string>("SELECT CAST(i32Field AS VARCHAR) || strField FROM TestType",
+ common::LexicalCast<std::string>(in.i32Field) + in.strField);
+}
+
+BOOST_AUTO_TEST_CASE(TestCoalesce)
+{
+ CheckSingleResult<std::string>("SELECT COALESCE('One', 'Two', 'Three')", "One");
+ CheckSingleResult<std::string>("SELECT COALESCE(NULL, 'Two', 'Three')", "Two");
+ CheckSingleResult<std::string>("SELECT COALESCE(NULL, 'Two', NULL)", "Two");
+ CheckSingleResult<std::string>("SELECT COALESCE(NULL, NULL, 'Three')", "Three");
+}
+
+BOOST_AUTO_TEST_CASE(TestNullif)
+{
+ TestType in;
+
+ in.strField = "SomeValue";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT NULLIF(strField, 'blablabla') FROM TestType", in.strField);
+ CheckSingleResult<std::string>("SELECT NULLIF(strField, 'SomeValue') FROM TestType", "");
+}
+
+BOOST_AUTO_TEST_SUITE_END()