You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/09/14 11:10:23 UTC
[07/50] ignite git commit: IGNITE-3760: ODBC: Added tests for
supported SQL92 string functions. This closes #1006.
IGNITE-3760: ODBC: Added tests for supported SQL92 string functions. This closes #1006.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c9922132
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c9922132
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c9922132
Branch: refs/heads/ignite-3661
Commit: c992213274ec5872ef7ce359efa51e26003424ad
Parents: e9c797f
Author: isapego <is...@gridgain.com>
Authored: Sun Sep 4 16:49:42 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 16:49:42 2016 +0300
----------------------------------------------------------------------
.../odbc-test/src/sql_string_functions_test.cpp | 63 ++++++++++++++++++++
.../cpp/odbc/src/config/connection_info.cpp | 4 +-
2 files changed, 65 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9922132/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 d1ce194..c85f80c 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
@@ -288,4 +288,67 @@ BOOST_AUTO_TEST_CASE(TestStringFunctionUcase)
CheckSingleResult<std::string>("SELECT {fn UCASE(strField)} FROM TestType", "HELLO WORLD!");
}
+BOOST_AUTO_TEST_CASE(Test92StringFunctionLower)
+{
+ TestType in;
+ in.strField = "Hello World!";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT LOWER(strField) FROM TestType", "hello world!");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionUpper)
+{
+ TestType in;
+ in.strField = "Hello World!";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT UPPER(strField) FROM TestType", "HELLO WORLD!");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionSubstring)
+{
+ TestType in;
+ in.strField = "Hello Ignite!";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT SUBSTRING(strField, 7) FROM TestType", "Ignite!");
+ CheckSingleResult<std::string>("SELECT SUBSTRING(strField, 7, 6) FROM TestType", "Ignite");
+ CheckSingleResult<std::string>("SELECT SUBSTRING(strField FROM 7) FROM TestType", "Ignite!");
+ CheckSingleResult<std::string>("SELECT SUBSTRING(strField FROM 7 FOR 6) FROM TestType", "Ignite");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimBoth)
+{
+ TestType in;
+ in.strField = " Lorem ipsum ";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT TRIM(BOTH FROM strField) FROM TestType", "Lorem ipsum");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimLeading)
+{
+ TestType in;
+ in.strField = " Lorem ipsum ";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT TRIM(LEADING FROM strField) FROM TestType", "Lorem ipsum ");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimTrailing)
+{
+ TestType in;
+ in.strField = " Lorem ipsum ";
+
+ testCache.Put(1, in);
+
+ CheckSingleResult<std::string>("SELECT TRIM(TRAILING FROM strField) FROM TestType", " Lorem ipsum");
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9922132/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index cff48cf..744a88e 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -315,8 +315,8 @@ namespace ignite
#ifdef SQL_SQL92_STRING_FUNCTIONS
// Bitmask enumerating the string scalar functions.
- intParams[SQL_SQL92_STRING_FUNCTIONS] = SQL_SSF_CONVERT | SQL_SSF_LOWER | SQL_SSF_UPPER |
- SQL_SSF_SUBSTRING | SQL_SSF_TRANSLATE;
+ intParams[SQL_SQL92_STRING_FUNCTIONS] = SQL_SSF_LOWER | SQL_SSF_UPPER | SQL_SSF_SUBSTRING |
+ SQL_SSF_TRIM_BOTH | SQL_SSF_TRIM_LEADING | SQL_SSF_TRIM_TRAILING;
#endif // SQL_SQL92_STRING_FUNCTIONS
#ifdef SQL_SQL92_DATETIME_FUNCTIONS