Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ED126200B84 for ; Mon, 5 Sep 2016 15:18:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EA681160ACC; Mon, 5 Sep 2016 13:18:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1AF37160AD7 for ; Mon, 5 Sep 2016 15:18:29 +0200 (CEST) Received: (qmail 67290 invoked by uid 500); 5 Sep 2016 13:18:29 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 66987 invoked by uid 99); 5 Sep 2016 13:18:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2016 13:18:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C4C8CE7E30; Mon, 5 Sep 2016 13:18:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Mon, 05 Sep 2016 13:18:35 -0000 Message-Id: <1339cb9f38ab4479a8b759c0c95549c6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/20] ignite git commit: IGNITE-3760: ODBC: Added tests for supported SQL92 string functions. This closes #1006. archived-at: Mon, 05 Sep 2016 13:18:31 -0000 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-3611-1 Commit: c992213274ec5872ef7ce359efa51e26003424ad Parents: e9c797f Author: isapego Authored: Sun Sep 4 16:49:42 2016 +0300 Committer: thatcoach 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("SELECT {fn UCASE(strField)} FROM TestType", "HELLO WORLD!"); } +BOOST_AUTO_TEST_CASE(Test92StringFunctionLower) +{ + TestType in; + in.strField = "Hello World!"; + + testCache.Put(1, in); + + CheckSingleResult("SELECT LOWER(strField) FROM TestType", "hello world!"); +} + +BOOST_AUTO_TEST_CASE(Test92StringFunctionUpper) +{ + TestType in; + in.strField = "Hello World!"; + + testCache.Put(1, in); + + CheckSingleResult("SELECT UPPER(strField) FROM TestType", "HELLO WORLD!"); +} + +BOOST_AUTO_TEST_CASE(Test92StringFunctionSubstring) +{ + TestType in; + in.strField = "Hello Ignite!"; + + testCache.Put(1, in); + + CheckSingleResult("SELECT SUBSTRING(strField, 7) FROM TestType", "Ignite!"); + CheckSingleResult("SELECT SUBSTRING(strField, 7, 6) FROM TestType", "Ignite"); + CheckSingleResult("SELECT SUBSTRING(strField FROM 7) FROM TestType", "Ignite!"); + CheckSingleResult("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("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("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("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