You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/09/26 12:13:16 UTC

[02/50] ignite git commit: IGNITE-3876: ODBC: Better handling of NULL values for output parameters. This closes #1099.

IGNITE-3876: ODBC: Better handling of NULL values for output parameters. This closes #1099.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/38d1d049
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/38d1d049
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/38d1d049

Branch: refs/heads/master
Commit: 38d1d0491ab9e6858a58b90d0e5d892d9fc0e284
Parents: 14959f2
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 26 11:04:56 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 26 11:04:56 2016 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/odbc-test/Makefile.am     |    1 +
 .../cpp/odbc-test/include/test_utils.h          |    8 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |    1 +
 .../project/vs/odbc-test.vcxproj.filters        |    3 +
 .../cpp/odbc-test/src/api_robustness_test.cpp   | 1006 ++++++++++++++++++
 .../cpp/odbc/include/ignite/odbc/common_types.h |    8 +-
 modules/platforms/cpp/odbc/src/entry_points.cpp |   19 +-
 modules/platforms/cpp/odbc/src/odbc.cpp         |  199 ++--
 modules/platforms/cpp/odbc/src/statement.cpp    |    2 +-
 9 files changed, 1145 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/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 a22e247..ccf1192 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -72,6 +72,7 @@ ignite_odbc_tests_SOURCES = \
     src/sql_types_test.cpp \
     src/sql_date_time_functions_test.cpp \
     src/sql_outer_join_test.cpp \
+    src/api_robustness_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/38d1d049/modules/platforms/cpp/odbc-test/include/test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/test_utils.h b/modules/platforms/cpp/odbc-test/include/test_utils.h
index e8cd089..e239f45 100644
--- a/modules/platforms/cpp/odbc-test/include/test_utils.h
+++ b/modules/platforms/cpp/odbc-test/include/test_utils.h
@@ -27,6 +27,14 @@
 
 #include <string>
 
+#define ODBC_FAIL_ON_ERROR(ret, type, handle)           \
+    if (!SQL_SUCCEEDED(ret))                            \
+    {                                                   \
+        Ignition::StopAll(true);                        \
+        BOOST_FAIL(GetOdbcErrorMessage(type, handle));  \
+    }
+
+
 namespace ignite
 {
     /** Read buffer size. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/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 98a1e58..91603dc 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -161,6 +161,7 @@
     <ClCompile Include="..\..\..\odbc\src\result_page.cpp" />
     <ClCompile Include="..\..\..\odbc\src\row.cpp" />
     <ClCompile Include="..\..\..\odbc\src\utility.cpp" />
+    <ClCompile Include="..\..\src\api_robustness_test.cpp" />
     <ClCompile Include="..\..\src\application_data_buffer_test.cpp" />
     <ClCompile Include="..\..\src\column_test.cpp" />
     <ClCompile Include="..\..\src\configuration_test.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/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 f348ee7..eef6abb 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
@@ -112,6 +112,9 @@
     <ClCompile Include="..\..\src\sql_date_time_functions_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\api_robustness_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\test_type.h">

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
new file mode 100644
index 0000000..008cf25
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
@@ -0,0 +1,1006 @@
+/*
+ * 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.
+ */
+
+#ifdef _WIN32
+#   include <windows.h>
+#endif
+
+#include <sql.h>
+#include <sqlext.h>
+
+#include <vector>
+#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 "ignite/impl/binary/binary_utils.h"
+
+#include "test_type.h"
+#include "test_utils.h"
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::common;
+
+using namespace boost::unit_test;
+
+using ignite::impl::binary::BinaryUtils;
+
+/**
+ * Test setup fixture.
+ */
+struct ApiRobustnessTestSuiteFixture 
+{
+    void Prepare()
+    {
+        // 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);
+    }
+
+    /**
+     * Establish connection to node.
+     *
+     * @param connectStr Connection string.
+     */
+    void Connect(const std::string& connectStr)
+    {
+        Prepare();
+
+        // Connect string
+        std::vector<SQLCHAR> connectStr0;
+
+        connectStr0.reserve(connectStr.size() + 1);
+        std::copy(connectStr.begin(), connectStr.end(), std::back_inserter(connectStr0));
+
+        SQLCHAR outstr[ODBC_BUFFER_SIZE];
+        SQLSMALLINT outstrlen;
+
+        // Connecting to ODBC server.
+        SQLRETURN ret = SQLDriverConnect(dbc, NULL, &connectStr0[0], static_cast<SQLSMALLINT>(connectStr0.size()),
+            outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE);
+
+        ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc);
+
+        // Allocate a statement handle
+        SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
+
+        BOOST_REQUIRE(stmt != NULL);
+    }
+
+    void Disconnect()
+    {
+        // 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);
+    }
+
+    static Ignite StartNode(const char* name, const char* config)
+    {
+        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");
+        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
+
+#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("/").append(config);
+
+        IgniteError err;
+
+        return Ignition::Start(cfg, name);
+    }
+
+    static Ignite StartAdditionalNode(const char* name)
+    {
+        return StartNode(name, "queries-test-noodbc.xml");
+    }
+
+    /**
+     * Constructor.
+     */
+    ApiRobustnessTestSuiteFixture() :
+        testCache(0),
+        env(NULL),
+        dbc(NULL),
+        stmt(NULL)
+    {
+        grid = StartNode("NodeMain", "queries-test.xml");
+
+        testCache = grid.GetCache<int64_t, TestType>("cache");
+    }
+
+    /**
+     * Destructor.
+     */
+    ~ApiRobustnessTestSuiteFixture()
+    {
+        Disconnect();
+
+        Ignition::StopAll(true);
+    }
+
+    /** Node started during the test. */
+    Ignite grid;
+
+    /** Test cache instance. */
+    Cache<int64_t, TestType> testCache;
+
+    /** ODBC Environment. */
+    SQLHENV env;
+
+    /** ODBC Connect. */
+    SQLHDBC dbc;
+
+    /** ODBC Statement. */
+    SQLHSTMT stmt;
+};
+
+BOOST_FIXTURE_TEST_SUITE(ApiRobustnessTestSuite, ApiRobustnessTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(TestSQLDriverConnect)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Prepare();
+
+    SQLCHAR connectStr[] = "DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache";
+
+    SQLCHAR outStr[ODBC_BUFFER_SIZE];
+    SQLSMALLINT outStrLen;
+
+    // Normal connect.
+    SQLRETURN ret = SQLDriverConnect(dbc, NULL, connectStr, sizeof(connectStr),
+        outStr, sizeof(outStr), &outStrLen, SQL_DRIVER_COMPLETE);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLDisconnect(dbc);
+
+    // Null out string resulting length.
+    SQLDriverConnect(dbc, NULL, connectStr, sizeof(connectStr), outStr, sizeof(outStr), 0, SQL_DRIVER_COMPLETE);
+
+    SQLDisconnect(dbc);
+
+    // Null out string buffer length.
+    SQLDriverConnect(dbc, NULL, connectStr, sizeof(connectStr), outStr, 0, &outStrLen, SQL_DRIVER_COMPLETE);
+
+    SQLDisconnect(dbc);
+
+    // Null out string.
+    SQLDriverConnect(dbc, NULL, connectStr, sizeof(connectStr), 0, sizeof(outStr), &outStrLen, SQL_DRIVER_COMPLETE);
+
+    SQLDisconnect(dbc);
+
+    // Null all.
+    SQLDriverConnect(dbc, NULL, connectStr, sizeof(connectStr), 0, 0, 0, SQL_DRIVER_COMPLETE);
+
+    SQLDisconnect(dbc);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLConnect)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLSMALLINT resLen = 0;
+
+    // Everyting is ok.
+    SQLRETURN ret = SQLGetInfo(dbc, SQL_DRIVER_NAME, buffer, ODBC_BUFFER_SIZE, &resLen);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Resulting length is null.
+    SQLGetInfo(dbc, SQL_DRIVER_NAME, buffer, ODBC_BUFFER_SIZE, 0);
+
+    // Buffer length is null.
+    SQLGetInfo(dbc, SQL_DRIVER_NAME, buffer, 0, &resLen);
+
+    // Buffer is null.
+    SQLGetInfo(dbc, SQL_DRIVER_NAME, 0, ODBC_BUFFER_SIZE, &resLen);
+
+    // Unknown info.
+    SQLGetInfo(dbc, -1, buffer, ODBC_BUFFER_SIZE, &resLen);
+
+    // All nulls.
+    SQLGetInfo(dbc, SQL_DRIVER_NAME, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLPrepare)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    // Everyting is ok.
+    SQLRETURN ret = SQLPrepare(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCloseCursor(stmt);
+
+    // Value length is null.
+    SQLPrepare(stmt, sql, 0);
+
+    SQLCloseCursor(stmt);
+
+    // Value is null.
+    SQLPrepare(stmt, 0, sizeof(sql));
+
+    SQLCloseCursor(stmt);
+
+    // All nulls.
+    SQLPrepare(stmt, 0, 0);
+
+    SQLCloseCursor(stmt);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLExecDirect)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    // Everyting is ok.
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCloseCursor(stmt);
+
+    // Value length is null.
+    SQLExecDirect(stmt, sql, 0);
+
+    SQLCloseCursor(stmt);
+
+    // Value is null.
+    SQLExecDirect(stmt, 0, sizeof(sql));
+
+    SQLCloseCursor(stmt);
+
+    // All nulls.
+    SQLExecDirect(stmt, 0, 0);
+
+    SQLCloseCursor(stmt);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLExtendedFetch)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    for (int i = 0; i < 100; ++i)
+    {
+        TestType obj;
+
+        obj.strField = LexicalCast<std::string>(i);
+
+        testCache.Put(i, obj);
+    }
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLULEN rowCount;
+    SQLUSMALLINT rowStatus[16];
+
+    // Everyting is ok.
+    ret = SQLExtendedFetch(stmt, SQL_FETCH_NEXT, 0, &rowCount, rowStatus);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Row count is null.
+    SQLExtendedFetch(stmt, SQL_FETCH_NEXT, 0, 0, rowStatus);
+
+    // Row statuses is null.
+    SQLExtendedFetch(stmt, SQL_FETCH_NEXT, 0, &rowCount, 0);
+
+    // All nulls.
+    SQLExtendedFetch(stmt, SQL_FETCH_NEXT, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLNumResultCols)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    for (int i = 0; i < 100; ++i)
+    {
+        TestType obj;
+
+        obj.strField = LexicalCast<std::string>(i);
+
+        testCache.Put(i, obj);
+    }
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLSMALLINT columnCount;
+
+    // Everyting is ok.
+    ret = SQLNumResultCols(stmt, &columnCount);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Column count is null.
+    SQLNumResultCols(stmt, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLTables)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR catalogName[] = "";
+    SQLCHAR schemaName[] = "";
+    SQLCHAR tableName[] = "";
+    SQLCHAR tableType[] = "";
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLTables(stmt, catalogName, sizeof(catalogName), schemaName,
+        sizeof(schemaName), tableName, sizeof(tableName), tableType, sizeof(tableType));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Sizes are nulls.
+    SQLTables(dbc, catalogName, 0, schemaName, 0, tableName, 0, tableType, 0);
+
+    // Values are nulls.
+    SQLTables(dbc, 0, sizeof(catalogName), 0, sizeof(schemaName), 0, sizeof(tableName), 0, sizeof(tableType));
+
+    // All nulls.
+    SQLTables(dbc, 0, 0, 0, 0, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLColumns)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR catalogName[] = "";
+    SQLCHAR schemaName[] = "";
+    SQLCHAR tableName[] = "";
+    SQLCHAR columnName[] = "";
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLColumns(stmt, catalogName, sizeof(catalogName), schemaName,
+        sizeof(schemaName), tableName, sizeof(tableName), columnName, sizeof(columnName));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Sizes are nulls.
+    SQLColumns(dbc, catalogName, 0, schemaName, 0, tableName, 0, columnName, 0);
+
+    // Values are nulls.
+    SQLColumns(dbc, 0, sizeof(catalogName), 0, sizeof(schemaName), 0, sizeof(tableName), 0, sizeof(columnName));
+
+    // All nulls.
+    SQLColumns(dbc, 0, 0, 0, 0, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLBindCol)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLINTEGER ind1;
+    SQLLEN len1 = 0;
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &ind1, sizeof(ind1), &len1);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Size is null.
+    SQLBindCol(stmt, 1, SQL_C_SLONG, &ind1, 0, &len1);
+
+    // Res size is null.
+    SQLBindCol(stmt, 2, SQL_C_SLONG, &ind1, sizeof(ind1), 0);
+
+    // Value is null.
+    SQLBindCol(stmt, 3, SQL_C_SLONG, 0, sizeof(ind1), &len1);
+
+    // All nulls.
+    SQLBindCol(stmt, 4, SQL_C_SLONG, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLBindParameter)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLINTEGER ind1;
+    SQLLEN len1 = 0;
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT,
+        SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, sizeof(ind1), &len1);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Size is null.
+    SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, 0, &len1);
+
+    // Res size is null.
+    SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, sizeof(ind1), 0);
+
+    // Value is null.
+    SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 100, 100, 0, sizeof(ind1), &len1);
+
+    // All nulls.
+    SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 100, 100, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLNativeSql)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLINTEGER resLen = 0;
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLNativeSql(dbc, sql, sizeof(sql), buffer, sizeof(buffer), &resLen);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Value size is null.
+    SQLNativeSql(dbc, sql, 0, buffer, sizeof(buffer), &resLen);
+
+    // Buffer size is null.
+    SQLNativeSql(dbc, sql, sizeof(sql), buffer, 0, &resLen);
+
+    // Res size is null.
+    SQLNativeSql(dbc, sql, sizeof(sql), buffer, sizeof(buffer), 0);
+
+    // Value is null.
+    SQLNativeSql(dbc, sql, 0, buffer, sizeof(buffer), &resLen);
+
+    // Buffer is null.
+    SQLNativeSql(dbc, sql, sizeof(sql), 0, sizeof(buffer), &resLen);
+
+    // All nulls.
+    SQLNativeSql(dbc, sql, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLColAttribute)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLSMALLINT resLen = 0;
+    SQLLEN numericAttr = 0;
+
+    // Everithing is ok. Character attribute.
+    ret = SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, buffer, sizeof(buffer), &resLen, &numericAttr);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    // Everithing is ok. Numeric attribute.
+    ret = SQLColAttribute(stmt, 1, SQL_DESC_COUNT, buffer, sizeof(buffer), &resLen, &numericAttr);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, buffer, sizeof(buffer), &resLen, 0);
+    SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, buffer, sizeof(buffer), 0, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, buffer, 0, &resLen, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, 0, sizeof(buffer), &resLen, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_COLUMN_TABLE_NAME, 0, 0, 0, 0);
+
+    SQLColAttribute(stmt, 1, SQL_DESC_COUNT, buffer, sizeof(buffer), &resLen, 0);
+    SQLColAttribute(stmt, 1, SQL_DESC_COUNT, buffer, sizeof(buffer), 0, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_DESC_COUNT, buffer, 0, &resLen, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_DESC_COUNT, 0, sizeof(buffer), &resLen, &numericAttr);
+    SQLColAttribute(stmt, 1, SQL_DESC_COUNT, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLDescribeCol)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCHAR columnName[ODBC_BUFFER_SIZE];
+    SQLSMALLINT columnNameLen = 0;
+    SQLSMALLINT dataType = 0;
+    SQLULEN columnSize = 0;
+    SQLSMALLINT decimalDigits = 0;
+    SQLSMALLINT nullable = 0;
+
+    // Everithing is ok.
+    ret = SQLDescribeCol(stmt, 1, columnName, sizeof(columnName),
+        &columnNameLen, &dataType, &columnSize, &decimalDigits, &nullable);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLDescribeCol(stmt, 1, 0, sizeof(columnName), &columnNameLen, &dataType, &columnSize, &decimalDigits, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, 0, &columnNameLen, &dataType, &columnSize, &decimalDigits, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, sizeof(columnName), 0, &dataType, &columnSize, &decimalDigits, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, sizeof(columnName), &columnNameLen, 0, &columnSize, &decimalDigits, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, sizeof(columnName), &columnNameLen, &dataType, 0, &decimalDigits, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, sizeof(columnName), &columnNameLen, &dataType, &columnSize, 0, &nullable);
+    SQLDescribeCol(stmt, 1, columnName, sizeof(columnName), &columnNameLen, &dataType, &columnSize, &decimalDigits, 0);
+    SQLDescribeCol(stmt, 1, 0, 0, 0, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLRowCount)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLLEN rows = 0;
+
+    // Everithing is ok.
+    ret = SQLRowCount(stmt, &rows);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLRowCount(stmt, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLForeignKeys)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR catalogName[] = "";
+    SQLCHAR schemaName[] = "cache";
+    SQLCHAR tableName[] = "TestType";
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName),
+        tableName, sizeof(tableName), catalogName, sizeof(catalogName),
+        schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, 0, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, 0, schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), 0, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, 0, tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), 0, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, 0, catalogName,
+        sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        0, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, 0, schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), 0, sizeof(schemaName), tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, 0, tableName, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), 0, sizeof(tableName));
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName),
+        catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, 0);
+
+    SQLCloseCursor(stmt);
+
+    SQLForeignKeys(stmt, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+    SQLCloseCursor(stmt);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLGetStmtAttr)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLINTEGER resLen = 0;
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, buffer, sizeof(buffer), &resLen);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, sizeof(buffer), &resLen);
+    SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, buffer, 0, &resLen);
+    SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, buffer, sizeof(buffer), 0);
+    SQLGetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLSetStmtAttr)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLULEN val = 1;
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, reinterpret_cast<SQLPOINTER>(val), sizeof(val));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, sizeof(val));
+    SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, reinterpret_cast<SQLPOINTER>(val), 0);
+    SQLSetStmtAttr(stmt, SQL_ATTR_ROW_ARRAY_SIZE, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLPrimaryKeys)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR catalogName[] = "";
+    SQLCHAR schemaName[] = "cache";
+    SQLCHAR tableName[] = "TestType";
+
+    // Everithing is ok.
+    SQLRETURN ret = SQLPrimaryKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName),
+        tableName, sizeof(tableName));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLPrimaryKeys(stmt, 0, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+    SQLPrimaryKeys(stmt, catalogName, 0, schemaName, sizeof(schemaName), tableName, sizeof(tableName));
+    SQLPrimaryKeys(stmt, catalogName, sizeof(catalogName), 0, sizeof(schemaName), tableName, sizeof(tableName));
+    SQLPrimaryKeys(stmt, catalogName, sizeof(catalogName), schemaName, 0, tableName, sizeof(tableName));
+    SQLPrimaryKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), 0, sizeof(tableName));
+    SQLPrimaryKeys(stmt, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName), tableName, 0);
+    SQLPrimaryKeys(stmt, 0, 0, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLNumParams)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    // Everyting is ok.
+    SQLRETURN ret = SQLPrepare(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLSMALLINT params;
+
+    // Everithing is ok.
+    ret = SQLNumParams(stmt, &params);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLNumParams(stmt, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLGetDiagField)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    // Should fail.
+    SQLRETURN ret = SQLGetTypeInfo(stmt, SQL_INTERVAL_MONTH);
+
+    BOOST_REQUIRE_EQUAL(ret, SQL_ERROR);
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLSMALLINT resLen = 0;
+
+    // Everithing is ok
+    ret = SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, buffer, sizeof(buffer), &resLen);
+
+    BOOST_REQUIRE_EQUAL(ret, SQL_SUCCESS);
+
+    SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, 0, sizeof(buffer), &resLen);
+    SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, buffer, 0, &resLen);
+    SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, buffer, sizeof(buffer), 0);
+    SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_MESSAGE_TEXT, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLGetDiagRec)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    // Should fail.
+    SQLRETURN ret = SQLGetTypeInfo(stmt, SQL_INTERVAL_MONTH);
+
+    BOOST_REQUIRE_EQUAL(ret, SQL_ERROR);
+
+    SQLCHAR state[ODBC_BUFFER_SIZE];
+    SQLINTEGER nativeError = 0;
+    SQLCHAR message[ODBC_BUFFER_SIZE];
+    SQLSMALLINT messageLen = 0;
+
+    // Everithing is ok
+    ret = SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, state, &nativeError, message, sizeof(message), &messageLen);
+
+    BOOST_REQUIRE_EQUAL(ret, SQL_SUCCESS);
+
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, 0, &nativeError, message, sizeof(message), &messageLen);
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, state, 0, message, sizeof(message), &messageLen);
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, state, &nativeError, 0, sizeof(message), &messageLen);
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, state, &nativeError, message, 0, &messageLen);
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, state, &nativeError, message, sizeof(message), 0);
+    SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, 0, 0, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLGetData)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    for (int i = 0; i < 100; ++i)
+    {
+        TestType obj;
+
+        obj.strField = LexicalCast<std::string>(i);
+
+        testCache.Put(i, obj);
+    }
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR sql[] = "SELECT strField FROM TestType";
+
+    SQLRETURN ret = SQLExecDirect(stmt, sql, sizeof(sql));
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    ret = SQLFetch(stmt);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLLEN resLen = 0;
+
+    // Everything is ok.
+    ret = SQLGetData(stmt, 1, SQL_C_CHAR, buffer, sizeof(buffer), &resLen);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLFetch(stmt);
+
+    SQLGetData(stmt, 1, SQL_C_CHAR, 0, sizeof(buffer), &resLen);
+
+    SQLFetch(stmt);
+
+    SQLGetData(stmt, 1, SQL_C_CHAR, buffer, 0, &resLen);
+
+    SQLFetch(stmt);
+
+    SQLGetData(stmt, 1, SQL_C_CHAR, buffer, sizeof(buffer), 0);
+
+    SQLFetch(stmt);
+
+    SQLGetData(stmt, 1, SQL_C_CHAR, 0, 0, 0);
+
+    SQLFetch(stmt);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLGetEnvAttr)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR buffer[ODBC_BUFFER_SIZE];
+    SQLINTEGER resLen = 0;
+
+    // Everything is ok.
+    SQLRETURN ret = SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, buffer, sizeof(buffer), &resLen);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env);
+
+    SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, 0, sizeof(buffer), &resLen);
+    SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, buffer, 0, &resLen);
+    SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, buffer, sizeof(buffer), 0);
+    SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, 0, 0, 0);
+}
+
+BOOST_AUTO_TEST_CASE(TestSQLSpecialColumns)
+{
+    // There are no checks because we do not really care what is the result of these
+    // calls as long as they do not cause segmentation fault.
+
+    Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+    SQLCHAR catalogName[] = "";
+    SQLCHAR schemaName[] = "cache";
+    SQLCHAR tableName[] = "TestType";
+
+    // Everything is ok.
+    SQLRETURN ret = SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, sizeof(catalogName),
+        schemaName, sizeof(schemaName), tableName, sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, 0, sizeof(catalogName), schemaName, sizeof(schemaName), tableName,
+        sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, 0, schemaName, sizeof(schemaName), tableName,
+        sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, sizeof(catalogName), 0, sizeof(schemaName), tableName,
+        sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, sizeof(catalogName), schemaName, 0, tableName,
+        sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName),
+        0, sizeof(tableName), SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, catalogName, sizeof(catalogName), schemaName, sizeof(schemaName),
+        tableName, 0, SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+
+    SQLSpecialColumns(stmt, SQL_BEST_ROWID, 0, 0, 0, 0, 0, 0, SQL_SCOPE_CURROW, SQL_NO_NULLS);
+
+    SQLCloseCursor(stmt);
+}
+
+BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
index 250eaf2..b01ec76 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/common_types.h
@@ -19,17 +19,13 @@
 #define _IGNITE_ODBC_COMMON_TYPES
 
 #include <stdint.h>
+#include "system/odbc_constants.h"
 
 namespace ignite
 {
     namespace odbc
     {
-
-#ifdef _WIN64
-        typedef long long SqlLen;
-#else
-        typedef long SqlLen;
-#endif
+        typedef SQLLEN SqlLen;
 
         /**
          * SQL result.

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/modules/platforms/cpp/odbc/src/entry_points.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/entry_points.cpp b/modules/platforms/cpp/odbc/src/entry_points.cpp
index f6195e1..c3d24bb 100644
--- a/modules/platforms/cpp/odbc/src/entry_points.cpp
+++ b/modules/platforms/cpp/odbc/src/entry_points.cpp
@@ -218,6 +218,8 @@ SQLRETURN SQL_API SQLNativeSql(SQLHDBC      conn,
         outQueryBuffer, outQueryBufferLen, outQueryLen);
 }
 
+
+#if defined _WIN64 || !defined _WIN32
 SQLRETURN SQL_API SQLColAttribute(SQLHSTMT        stmt,
                                   SQLUSMALLINT    columnNum,
                                   SQLUSMALLINT    fieldId,
@@ -225,9 +227,18 @@ SQLRETURN SQL_API SQLColAttribute(SQLHSTMT        stmt,
                                   SQLSMALLINT     bufferLen,
                                   SQLSMALLINT*    strAttrLen,
                                   SQLLEN*         numericAttr)
+#else
+SQLRETURN SQL_API SQLColAttribute(SQLHSTMT       stmt,
+                                  SQLUSMALLINT   columnNum,
+                                  SQLUSMALLINT   fieldId,
+                                  SQLPOINTER     strAttr,
+                                  SQLSMALLINT    bufferLen,
+                                  SQLSMALLINT*   strAttrLen,
+                                  SQLPOINTER     numericAttr)
+#endif
 {
     return ignite::SQLColAttribute(stmt, columnNum, fieldId,
-        strAttr, bufferLen, strAttrLen, numericAttr);
+        strAttr, bufferLen, strAttrLen, (SQLLEN*)numericAttr);
 }
 
 SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT       stmt,
@@ -373,15 +384,15 @@ SQLRETURN SQL_API SQLGetEnvAttr(SQLHENV     env,
 }
 
 SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT    stmt,
-                                    SQLSMALLINT idType,
+                                    SQLUSMALLINT idType,
                                     SQLCHAR*    catalogName,
                                     SQLSMALLINT catalogNameLen,
                                     SQLCHAR*    schemaName,
                                     SQLSMALLINT schemaNameLen,
                                     SQLCHAR*    tableName,
                                     SQLSMALLINT tableNameLen,
-                                    SQLSMALLINT scope,
-                                    SQLSMALLINT nullable)
+                                    SQLUSMALLINT scope,
+                                    SQLUSMALLINT nullable)
 {
     return ignite::SQLSpecialColumns(stmt, idType, catalogName,
         catalogNameLen, schemaName, schemaNameLen, tableName,

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index fd35cba..74d0f9d 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -39,8 +39,8 @@ namespace ignite
                          SQLSMALLINT    infoValueMax,
                          SQLSMALLINT*   length)
     {
-        using ignite::odbc::Connection;
-        using ignite::odbc::config::ConnectionInfo;
+        using odbc::Connection;
+        using odbc::config::ConnectionInfo;
 
         LOG_MSG("SQLGetInfo called: %d (%s), %p, %d, %p\n",
                 infoType, ConnectionInfo::InfoTypeToString(infoType),
@@ -81,7 +81,7 @@ namespace ignite
 
     SQLRETURN SQLAllocEnv(SQLHENV* env)
     {
-        using ignite::odbc::Environment;
+        using odbc::Environment;
 
         LOG_MSG("SQLAllocEnv called\n");
 
@@ -92,8 +92,8 @@ namespace ignite
 
     SQLRETURN SQLAllocConnect(SQLHENV env, SQLHDBC* conn)
     {
-        using ignite::odbc::Environment;
-        using ignite::odbc::Connection;
+        using odbc::Environment;
+        using odbc::Connection;
 
         LOG_MSG("SQLAllocConnect called\n");
 
@@ -116,8 +116,8 @@ namespace ignite
 
     SQLRETURN SQLAllocStmt(SQLHDBC conn, SQLHSTMT* stmt)
     {
-        using ignite::odbc::Connection;
-        using ignite::odbc::Statement;
+        using odbc::Connection;
+        using odbc::Statement;
 
         LOG_MSG("SQLAllocStmt called\n");
 
@@ -158,7 +158,7 @@ namespace ignite
 
     SQLRETURN SQLFreeEnv(SQLHENV env)
     {
-        using ignite::odbc::Environment;
+        using odbc::Environment;
 
         LOG_MSG("SQLFreeEnv called\n");
 
@@ -174,7 +174,7 @@ namespace ignite
 
     SQLRETURN SQLFreeConnect(SQLHDBC conn)
     {
-        using ignite::odbc::Connection;
+        using odbc::Connection;
 
         LOG_MSG("SQLFreeConnect called\n");
 
@@ -190,7 +190,7 @@ namespace ignite
 
     SQLRETURN SQLFreeStmt(SQLHSTMT stmt, SQLUSMALLINT option)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLFreeStmt called\n");
 
@@ -236,7 +236,7 @@ namespace ignite
 
     SQLRETURN SQLCloseCursor(SQLHSTMT stmt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLCloseCursor called\n");
 
@@ -311,9 +311,9 @@ namespace ignite
                          SQLCHAR*       auth,
                          SQLSMALLINT    authLen)
     {
-        using ignite::odbc::Connection;
-        using ignite::odbc::config::Configuration;
-        using ignite::utility::SqlStringToString;
+        using odbc::Connection;
+        using odbc::config::Configuration;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLConnect called\n");
 
@@ -335,7 +335,7 @@ namespace ignite
 
     SQLRETURN SQLDisconnect(SQLHDBC conn)
     {
-        using ignite::odbc::Connection;
+        using odbc::Connection;
 
         LOG_MSG("SQLDisconnect called\n");
 
@@ -351,8 +351,8 @@ namespace ignite
 
     SQLRETURN SQLPrepare(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLPrepare called\n");
 
@@ -372,7 +372,7 @@ namespace ignite
 
     SQLRETURN SQLExecute(SQLHSTMT stmt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLExecute called\n");
 
@@ -388,8 +388,8 @@ namespace ignite
 
     SQLRETURN SQLExecDirect(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLExecDirect called\n");
 
@@ -414,10 +414,10 @@ namespace ignite
                          SQLLEN         bufferLength,
                          SQLLEN*        strLengthOrIndicator)
     {
-        using namespace ignite::odbc::type_traits;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::Statement;
-        using ignite::odbc::app::ApplicationDataBuffer;
+        using odbc::Statement;
+        using odbc::app::ApplicationDataBuffer;
 
         LOG_MSG("SQLBindCol called: index=%d, type=%d\n", colNum, targetType);
 
@@ -448,7 +448,7 @@ namespace ignite
 
     SQLRETURN SQLFetch(SQLHSTMT stmt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLFetch called\n");
 
@@ -483,7 +483,7 @@ namespace ignite
 
         SQLRETURN res = SQLFetchScroll(stmt, orientation, offset);
 
-        if (res == SQL_SUCCESS || res == SQL_NO_DATA)
+        if (res == SQL_SUCCESS)
         {
             if (rowCount)
                 *rowCount = 1;
@@ -491,14 +491,16 @@ namespace ignite
             if (rowStatusArray)
                 rowStatusArray[0] = SQL_ROW_SUCCESS;
         }
+        else if (res == SQL_NO_DATA && rowCount)
+            *rowCount = 0;
 
         return res;
     }
 
     SQLRETURN SQLNumResultCols(SQLHSTMT stmt, SQLSMALLINT *columnNum)
     {
-        using ignite::odbc::Statement;
-        using ignite::odbc::meta::ColumnMetaVector;
+        using odbc::Statement;
+        using odbc::meta::ColumnMetaVector;
 
         LOG_MSG("SQLNumResultCols called\n");
 
@@ -509,7 +511,8 @@ namespace ignite
 
         int32_t res = statement->GetColumnNumber();
 
-        *columnNum = static_cast<SQLSMALLINT>(res);
+        if (columnNum)
+            *columnNum = static_cast<SQLSMALLINT>(res);
 
         LOG_MSG("columnNum: %d\n", *columnNum);
 
@@ -526,8 +529,8 @@ namespace ignite
                         SQLCHAR*    tableType,
                         SQLSMALLINT tableTypeLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLTables called\n");
 
@@ -561,8 +564,8 @@ namespace ignite
                          SQLCHAR*       columnName,
                          SQLSMALLINT    columnNameLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLColumns called\n");
 
@@ -588,7 +591,7 @@ namespace ignite
 
     SQLRETURN SQLMoreResults(SQLHSTMT stmt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLMoreResults called\n");
 
@@ -611,12 +614,12 @@ namespace ignite
                                SQLLEN       bufferLen,
                                SQLLEN*      resLen)
     {
-        using namespace ignite::odbc::type_traits;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::Statement;
-        using ignite::odbc::app::ApplicationDataBuffer;
-        using ignite::odbc::app::Parameter;
-        using ignite::odbc::type_traits::IsSqlTypeSupported;
+        using odbc::Statement;
+        using odbc::app::ApplicationDataBuffer;
+        using odbc::app::Parameter;
+        using odbc::type_traits::IsSqlTypeSupported;
 
         LOG_MSG("SQLBindParameter called\n");
 
@@ -628,7 +631,7 @@ namespace ignite
         if (ioType != SQL_PARAM_INPUT)
             return SQL_ERROR;
 
-        if (*resLen == SQL_DATA_AT_EXEC || *resLen <= SQL_LEN_DATA_AT_EXEC_OFFSET)
+        if (resLen && (*resLen == SQL_DATA_AT_EXEC || *resLen <= SQL_LEN_DATA_AT_EXEC_OFFSET))
             return SQL_ERROR;
 
         if (!IsSqlTypeSupported(paramSqlType))
@@ -660,7 +663,7 @@ namespace ignite
                            SQLINTEGER   outQueryBufferLen,
                            SQLINTEGER*  outQueryLen)
     {
-        using namespace ignite::utility;
+        using namespace utility;
 
         LOG_MSG("SQLNativeSql called\n");
 
@@ -669,7 +672,8 @@ namespace ignite
         CopyStringToBuffer(in, reinterpret_cast<char*>(outQueryBuffer),
             static_cast<size_t>(outQueryBufferLen));
 
-        *outQueryLen = std::min(outQueryBufferLen, static_cast<SQLINTEGER>(in.size()));
+        if (outQueryLen)
+            *outQueryLen = std::min(outQueryBufferLen, static_cast<SQLINTEGER>(in.size()));
 
         return SQL_SUCCESS;
     }
@@ -682,9 +686,9 @@ namespace ignite
                               SQLSMALLINT*    strAttrLen,
                               SQLLEN*         numericAttr)
     {
-        using ignite::odbc::Statement;
-        using ignite::odbc::meta::ColumnMetaVector;
-        using ignite::odbc::meta::ColumnMeta;
+        using odbc::Statement;
+        using odbc::meta::ColumnMetaVector;
+        using odbc::meta::ColumnMeta;
 
         LOG_MSG("SQLColAttribute called: %d (%s)\n", fieldId, ColumnMeta::AttrIdToString(fieldId));
 
@@ -700,7 +704,7 @@ namespace ignite
 
             SQLRETURN res = SQLNumResultCols(stmt, &val);
 
-            if (res == SQL_SUCCESS)
+            if (numericAttr && res == SQL_SUCCESS)
                 *numericAttr = val;
 
             return res;
@@ -722,8 +726,8 @@ namespace ignite
                              SQLSMALLINT*   decimalDigits, 
                              SQLSMALLINT*   nullable)
     {
-        using ignite::odbc::Statement;
-        using ignite::odbc::SqlLen;
+        using odbc::Statement;
+        using odbc::SqlLen;
 
         LOG_MSG("SQLDescribeCol called\n");
 
@@ -750,13 +754,20 @@ namespace ignite
         LOG_MSG("columnSizeRes: %lld\n", columnSizeRes);
         LOG_MSG("decimalDigitsRes: %lld\n", decimalDigitsRes);
         LOG_MSG("nullableRes: %lld\n", nullableRes);
-        LOG_MSG("columnNameBuf: %s\n", columnNameBuf);
-        LOG_MSG("columnNameLen: %d\n", *columnNameLen);
+        LOG_MSG("columnNameBuf: %s\n", columnNameBuf ? columnNameBuf : "<null>");
+        LOG_MSG("columnNameLen: %d\n", columnNameLen ? *columnNameLen : -1);
+
+        if (dataType)
+            *dataType = static_cast<SQLSMALLINT>(dataTypeRes);
+
+        if (columnSize)
+            *columnSize = static_cast<SQLULEN>(columnSizeRes);
 
-        *dataType = static_cast<SQLSMALLINT>(dataTypeRes);
-        *columnSize = static_cast<SQLULEN>(columnSizeRes);
-        *decimalDigits = static_cast<SQLSMALLINT>(decimalDigitsRes);
-        *nullable = static_cast<SQLSMALLINT>(nullableRes);
+        if (decimalDigits)
+            *decimalDigits = static_cast<SQLSMALLINT>(decimalDigitsRes);
+
+        if (nullable)
+            *nullable = static_cast<SQLSMALLINT>(nullableRes);
 
         return statement->GetDiagnosticRecords().GetReturnCode();
     }
@@ -764,7 +775,7 @@ namespace ignite
 
     SQLRETURN SQLRowCount(SQLHSTMT stmt, SQLLEN* rowCnt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLRowCount called\n");
 
@@ -775,7 +786,8 @@ namespace ignite
 
         int64_t res = statement->AffectedRows();
 
-        *rowCnt = static_cast<SQLLEN>(res);
+        if (rowCnt)
+            *rowCnt = static_cast<SQLLEN>(res);
 
         return statement->GetDiagnosticRecords().GetReturnCode();
     }
@@ -794,8 +806,8 @@ namespace ignite
                              SQLCHAR*       foreignTableName,
                              SQLSMALLINT    foreignTableNameLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLForeignKeys called\n");
 
@@ -830,21 +842,24 @@ namespace ignite
                              SQLINTEGER     valueBufLen,
                              SQLINTEGER*    valueResLen)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLGetStmtAttr called");
 
-    #ifdef ODBC_DEBUG
-        using ignite::odbc::type_traits::StatementAttrIdToString;
+#ifdef ODBC_DEBUG
+        using odbc::type_traits::StatementAttrIdToString;
 
         LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
-    #endif //ODBC_DEBUG
+#endif //ODBC_DEBUG
 
         Statement *statement = reinterpret_cast<Statement*>(stmt);
 
         if (!statement)
             return SQL_INVALID_HANDLE;
 
+        if (!valueBuf)
+            return SQL_ERROR;
+
         switch (attr)
         {
             case SQL_ATTR_APP_ROW_DESC:
@@ -916,15 +931,15 @@ namespace ignite
                              SQLPOINTER  value,
                              SQLINTEGER  valueLen)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLSetStmtAttr called");
 
-    #ifdef ODBC_DEBUG
-        using ignite::odbc::type_traits::StatementAttrIdToString;
+#ifdef ODBC_DEBUG
+        using odbc::type_traits::StatementAttrIdToString;
 
         LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
-    #endif //ODBC_DEBUG
+#endif //ODBC_DEBUG
 
         Statement *statement = reinterpret_cast<Statement*>(stmt);
 
@@ -988,8 +1003,8 @@ namespace ignite
                              SQLCHAR*       tableName,
                              SQLSMALLINT    tableNameLen)
     {
-        using ignite::odbc::Statement;
-        using ignite::utility::SqlStringToString;
+        using odbc::Statement;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLPrimaryKeys called\n");
 
@@ -1013,7 +1028,7 @@ namespace ignite
 
     SQLRETURN SQLNumParams(SQLHSTMT stmt, SQLSMALLINT* paramCnt)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLNumParams called\n");
 
@@ -1022,7 +1037,8 @@ namespace ignite
         if (!statement)
             return SQL_INVALID_HANDLE;
 
-        *paramCnt = static_cast<SQLSMALLINT>(statement->GetParametersNumber());
+        if (paramCnt)
+            *paramCnt = static_cast<SQLSMALLINT>(statement->GetParametersNumber());
 
         return statement->GetDiagnosticRecords().GetReturnCode();
     }
@@ -1035,11 +1051,11 @@ namespace ignite
                               SQLSMALLINT   bufferLen,
                               SQLSMALLINT*  resLen)
     {
-        using namespace ignite::odbc;
-        using namespace ignite::odbc::diagnostic;
-        using namespace ignite::odbc::type_traits;
+        using namespace odbc;
+        using namespace odbc::diagnostic;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::app::ApplicationDataBuffer;
+        using odbc::app::ApplicationDataBuffer;
 
         LOG_MSG("SQLGetDiagField called: %d\n", recNum);
 
@@ -1070,7 +1086,7 @@ namespace ignite
             }
         }
 
-        if (result == SQL_RESULT_SUCCESS)
+        if (resLen && result == SQL_RESULT_SUCCESS)
             *resLen = static_cast<SQLSMALLINT>(outResLen);
 
         return SqlResultToReturnCode(result);
@@ -1085,12 +1101,12 @@ namespace ignite
                             SQLSMALLINT     msgBufferLen,
                             SQLSMALLINT*    msgLen)
     {
-        using namespace ignite::utility;
-        using namespace ignite::odbc;
-        using namespace ignite::odbc::diagnostic;
-        using namespace ignite::odbc::type_traits;
+        using namespace utility;
+        using namespace odbc;
+        using namespace odbc::diagnostic;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::app::ApplicationDataBuffer;
+        using odbc::app::ApplicationDataBuffer;
 
         LOG_MSG("SQLGetDiagRec called\n");
 
@@ -1129,14 +1145,15 @@ namespace ignite
 
         outBuffer.PutString(record.GetMessageText());
 
-        *msgLen = static_cast<SQLSMALLINT>(outResLen);
+        if (msgLen)
+            *msgLen = static_cast<SQLSMALLINT>(outResLen);
 
         return SQL_SUCCESS;
     }
 
     SQLRETURN SQLGetTypeInfo(SQLHSTMT stmt, SQLSMALLINT type)
     {
-        using ignite::odbc::Statement;
+        using odbc::Statement;
 
         LOG_MSG("SQLGetTypeInfo called\n");
 
@@ -1152,7 +1169,7 @@ namespace ignite
 
     SQLRETURN SQLEndTran(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT completionType)
     {
-        using namespace ignite::odbc;
+        using namespace odbc;
 
         LOG_MSG("SQLEndTran called\n");
 
@@ -1212,10 +1229,10 @@ namespace ignite
                          SQLLEN         bufferLength,
                          SQLLEN*        strLengthOrIndicator)
     {
-        using namespace ignite::odbc::type_traits;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::Statement;
-        using ignite::odbc::app::ApplicationDataBuffer;
+        using odbc::Statement;
+        using odbc::app::ApplicationDataBuffer;
 
         LOG_MSG("SQLGetData called\n");
 
@@ -1238,7 +1255,7 @@ namespace ignite
                             SQLPOINTER  value,
                             SQLINTEGER  valueLen)
     {
-        using ignite::odbc::Environment;
+        using odbc::Environment;
 
         LOG_MSG("SQLSetEnvAttr called\n");
 
@@ -1258,10 +1275,10 @@ namespace ignite
                             SQLINTEGER  valueBufLen,
                             SQLINTEGER* valueResLen)
     {
-        using namespace ignite::odbc;
-        using namespace ignite::odbc::type_traits;
+        using namespace odbc;
+        using namespace odbc::type_traits;
 
-        using ignite::odbc::app::ApplicationDataBuffer;
+        using odbc::app::ApplicationDataBuffer;
 
         LOG_MSG("SQLGetEnvAttr called\n");
 
@@ -1293,9 +1310,9 @@ namespace ignite
                                 SQLSMALLINT scope,
                                 SQLSMALLINT nullable)
     {
-        using namespace ignite::odbc;
+        using namespace odbc;
 
-        using ignite::utility::SqlStringToString;
+        using utility::SqlStringToString;
 
         LOG_MSG("SQLSpecialColumns called\n");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/38d1d049/modules/platforms/cpp/odbc/src/statement.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index 96a6327..8aae156 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -463,7 +463,7 @@ namespace ignite
                 if (found && strbuf)
                     outSize = utility::CopyStringToBuffer(out, strbuf, buflen);
 
-                if (found && strbuf)
+                if (found && reslen)
                     *reslen = static_cast<int16_t>(outSize);
             }