ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/5] ignite git commit: IGNITE-2557: Added tests.
Date Thu, 17 Mar 2016 10:53:24 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 84e312a..53717c7 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -28,1660 +28,1337 @@
 #include "ignite/odbc/environment.h"
 #include "ignite/odbc/connection.h"
 #include "ignite/odbc/statement.h"
+#include "ignite/odbc.h"
 
-#ifdef ODBC_DEBUG
-
-FILE* log_file = NULL;
-
-void logInit(const char* path)
+namespace ignite
 {
-    if (!log_file)
+
+    BOOL ConfigDSN(HWND     hwndParent,
+                   WORD     req,
+                   LPCSTR   driver,
+                   LPCSTR   attributes)
     {
-        log_file = fopen(path, "w");
-    }
-}
+        LOG_MSG("ConfigDSN called\n");
 
-#endif //ODBC_DEBUG
+        ignite::odbc::config::Configuration config;
 
-BOOL INSTAPI ConfigDSN(HWND     hwndParent,
-                       WORD     req,
-                       LPCSTR   driver,
-                       LPCSTR   attributes)
-{
-    LOG_MSG("ConfigDSN called\n");
+        config.FillFromConfigAttributes(attributes);
 
-    ignite::odbc::config::Configuration config;
+        if (!SQLValidDSN(config.GetDsn().c_str()))
+            return SQL_FALSE;
 
-    config.FillFromConfigAttributes(attributes);
+        LOG_MSG("Driver: %s\n", driver);
+        LOG_MSG("Attributes: %s\n", attributes);
 
-    if (!SQLValidDSN(config.GetDsn().c_str()))
-        return SQL_FALSE;
+        LOG_MSG("DSN: %s\n", config.GetDsn().c_str());
 
-    LOG_MSG("Driver: %s\n", driver);
-    LOG_MSG("Attributes: %s\n", attributes);
+        switch (req)
+        {
+            case ODBC_ADD_DSN:
+            {
+                LOG_MSG("ODBC_ADD_DSN\n");
+
+                return SQLWriteDSNToIni(config.GetDsn().c_str(), driver);
+            }
+
+            case ODBC_CONFIG_DSN:
+            {
+                LOG_MSG("ODBC_CONFIG_DSN\n");
+                break;
+            }
+
+            case ODBC_REMOVE_DSN:
+            {
+                LOG_MSG("ODBC_REMOVE_DSN\n");
+
+                return SQLRemoveDSNFromIni(config.GetDsn().c_str());
+            }
+
+            default:
+            {
+                return SQL_FALSE;
+            }
+        }
 
-    LOG_MSG("DSN: %s\n", config.GetDsn().c_str());
+        return SQL_TRUE;
+    }
 
-    switch (req)
+    SQLRETURN SQLGetInfo(SQLHDBC        conn,
+                         SQLUSMALLINT   infoType,
+                         SQLPOINTER     infoValue,
+                         SQLSMALLINT    infoValueMax,
+                         SQLSMALLINT*   length)
     {
-        case ODBC_ADD_DSN:
-        {
-            LOG_MSG("ODBC_ADD_DSN\n");
+        using ignite::odbc::Connection;
+        using ignite::odbc::config::ConnectionInfo;
 
-            return SQLWriteDSNToIni(config.GetDsn().c_str(), driver);
-        }
+        LOG_MSG("SQLGetInfo called: %d (%s), %p, %d, %p\n",
+                infoType, ConnectionInfo::InfoTypeToString(infoType),
+                infoValue, infoValueMax, length);
 
-        case ODBC_CONFIG_DSN:
-        {
-            LOG_MSG("ODBC_CONFIG_DSN\n");
-            break;
-        }
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-        case ODBC_REMOVE_DSN:
-        {
-            LOG_MSG("ODBC_REMOVE_DSN\n");
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-            return SQLRemoveDSNFromIni(config.GetDsn().c_str());
-        }
+        connection->GetInfo(infoType, infoValue, infoValueMax, length);
 
-        default:
-        {
-            return SQL_FALSE;
-        }
+        return connection->GetDiagnosticRecords().GetReturnCode();
     }
 
-    return SQL_TRUE;
-}
-
-SQLRETURN SQL_API SQLGetInfo(SQLHDBC        conn,
-                             SQLUSMALLINT   infoType,
-                             SQLPOINTER     infoValue,
-                             SQLSMALLINT    infoValueMax,
-                             SQLSMALLINT*   length)
-{
-    using ignite::odbc::Connection;
-    using ignite::odbc::config::ConnectionInfo;
-
-    LOG_MSG("SQLGetInfo called: %d (%s)\n", infoType, ConnectionInfo::InfoTypeToString(infoType));
+    SQLRETURN SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result)
+    {
+        //LOG_MSG("SQLAllocHandle called\n");
+        switch (type)
+        {
+            case SQL_HANDLE_ENV:
+                return SQLAllocEnv(result);
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+            case SQL_HANDLE_DBC:
+                return SQLAllocConnect(parent, result);
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+            case SQL_HANDLE_STMT:
+                return SQLAllocStmt(parent, result);
 
-    connection->GetInfo(infoType, infoValue, infoValueMax, length);
+            case SQL_HANDLE_DESC:
+            default:
+                break;
+        }
 
-    return connection->GetDiagnosticRecords().GetReturnCode();
-}
+        *result = 0;
+        return SQL_ERROR;
+    }
 
-SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT type, SQLHANDLE parent, SQLHANDLE* result)
-{
-    //LOG_MSG("SQLAllocHandle called\n");
-    switch (type)
+    SQLRETURN SQLAllocEnv(SQLHENV* env)
     {
-        case SQL_HANDLE_ENV:
-            return SQLAllocEnv(result);
+        using ignite::odbc::Environment;
 
-        case SQL_HANDLE_DBC:
-            return SQLAllocConnect(parent, result);
+        LOG_MSG("SQLAllocEnv called\n");
 
-        case SQL_HANDLE_STMT:
-            return SQLAllocStmt(parent, result);
+        *env = reinterpret_cast<SQLHENV>(new Environment());
 
-        case SQL_HANDLE_DESC:
-        default:
-            break;
+        return SQL_SUCCESS;
     }
 
-    *result = 0;
-    return SQL_ERROR;
-}
+    SQLRETURN SQLAllocConnect(SQLHENV env, SQLHDBC* conn)
+    {
+        using ignite::odbc::Environment;
+        using ignite::odbc::Connection;
 
-SQLRETURN SQL_API SQLAllocEnv(SQLHENV* env)
-{
-    using ignite::odbc::Environment;
+        LOG_MSG("SQLAllocConnect called\n");
 
-    LOG_MSG("SQLAllocEnv called\n");
+        *conn = SQL_NULL_HDBC;
 
-    *env = reinterpret_cast<SQLHENV>(new Environment());
+        Environment *environment = reinterpret_cast<Environment*>(env);
 
-    return SQL_SUCCESS;
-}
+        if (!environment)
+            return SQL_INVALID_HANDLE;
 
-SQLRETURN SQL_API SQLAllocConnect(SQLHENV env, SQLHDBC* conn)
-{
-    using ignite::odbc::Environment;
-    using ignite::odbc::Connection;
+        Connection *connection = environment->CreateConnection();
 
-    LOG_MSG("SQLAllocConnect called\n");
+        if (!connection)
+            return environment->GetDiagnosticRecords().GetReturnCode();
 
-    *conn = SQL_NULL_HDBC;
+        *conn = reinterpret_cast<SQLHDBC>(connection);
 
-    Environment *environment = reinterpret_cast<Environment*>(env);
+        return SQL_SUCCESS;
+    }
 
-    if (!environment)
-        return SQL_INVALID_HANDLE;
+    SQLRETURN SQLAllocStmt(SQLHDBC conn, SQLHSTMT* stmt)
+    {
+        using ignite::odbc::Connection;
+        using ignite::odbc::Statement;
 
-    Connection *connection = environment->CreateConnection();
+        LOG_MSG("SQLAllocStmt called\n");
 
-    if (!connection)
-        return environment->GetDiagnosticRecords().GetReturnCode();
+        *stmt = SQL_NULL_HDBC;
 
-    *conn = reinterpret_cast<SQLHDBC>(connection);
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-    return SQL_SUCCESS;
-}
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-SQLRETURN SQL_API SQLAllocStmt(SQLHDBC conn, SQLHSTMT* stmt)
-{
-    using ignite::odbc::Connection;
-    using ignite::odbc::Statement;
+        Statement *statement = connection->CreateStatement();
 
-    LOG_MSG("SQLAllocStmt called\n");
+        *stmt = reinterpret_cast<SQLHSTMT>(statement);
 
-    *stmt = SQL_NULL_HDBC;
+        return connection->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+    SQLRETURN SQLFreeHandle(SQLSMALLINT type, SQLHANDLE handle)
+    {
+        switch (type)
+        {
+            case SQL_HANDLE_ENV:
+                return SQLFreeEnv(handle);
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+            case SQL_HANDLE_DBC:
+                return SQLFreeConnect(handle);
 
-    Statement *statement = connection->CreateStatement();
+            case SQL_HANDLE_STMT:
+                return SQLFreeStmt(handle, SQL_DROP);
 
-    *stmt = reinterpret_cast<SQLHSTMT>(statement);
+            case SQL_HANDLE_DESC:
+            default:
+                break;
+        }
 
-    return connection->GetDiagnosticRecords().GetReturnCode();
-}
+        return SQL_ERROR;
+    }
 
-SQLRETURN SQL_API SQLFreeHandle(SQLSMALLINT type, SQLHANDLE handle)
-{
-    switch (type)
+    SQLRETURN SQLFreeEnv(SQLHENV env)
     {
-        case SQL_HANDLE_ENV:
-            return SQLFreeEnv(handle);
+        using ignite::odbc::Environment;
 
-        case SQL_HANDLE_DBC:
-            return SQLFreeConnect(handle);
+        LOG_MSG("SQLFreeEnv called\n");
 
-        case SQL_HANDLE_STMT:
-            return SQLFreeStmt(handle, SQL_DROP);
+        Environment *environment = reinterpret_cast<Environment*>(env);
 
-        case SQL_HANDLE_DESC:
-        default:
-            break;
-    }
+        if (!environment)
+            return SQL_INVALID_HANDLE;
 
-    return SQL_ERROR;
-}
+        delete environment;
 
-SQLRETURN SQL_API SQLFreeEnv(SQLHENV env)
-{
-    using ignite::odbc::Environment;
+        return SQL_SUCCESS;
+    }
 
-    LOG_MSG("SQLFreeEnv called\n");
+    SQLRETURN SQLFreeConnect(SQLHDBC conn)
+    {
+        using ignite::odbc::Connection;
 
-    Environment *environment = reinterpret_cast<Environment*>(env);
+        LOG_MSG("SQLFreeConnect called\n");
 
-    if (!environment)
-        return SQL_INVALID_HANDLE;
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-    delete environment;
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-    return SQL_SUCCESS;
-}
+        delete connection;
 
-SQLRETURN SQL_API SQLFreeConnect(SQLHDBC conn)
-{
-    using ignite::odbc::Connection;
+        return SQL_SUCCESS;
+    }
 
-    LOG_MSG("SQLFreeConnect called\n");
+    SQLRETURN SQLFreeStmt(SQLHSTMT stmt, SQLUSMALLINT option)
+    {
+        using ignite::odbc::Statement;
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+        LOG_MSG("SQLFreeStmt called\n");
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    delete connection;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    return SQL_SUCCESS;
-}
+        switch (option)
+        {
+            case SQL_DROP:
+            {
+                delete statement;
 
-SQLRETURN SQL_API SQLFreeStmt(SQLHSTMT stmt, SQLUSMALLINT option)
-{
-    using ignite::odbc::Statement;
+                break;
+            }
 
-    LOG_MSG("SQLFreeStmt called\n");
+            case SQL_CLOSE:
+            {
+                return SQLCloseCursor(stmt);
+            }
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+            case SQL_UNBIND:
+            {
+                statement->UnbindAllColumns();
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+                break;
+            }
 
-    switch (option)
-    {
-        case SQL_DROP:
-        {
-            delete statement;
+            case SQL_RESET_PARAMS:
+            {
+                statement->UnbindAllParameters();
 
-            break;
-        }
+                break;
+            }
 
-        case SQL_CLOSE:
-        {
-            return SQLCloseCursor(stmt);
+            default:
+                return SQL_ERROR;
         }
 
-        case SQL_UNBIND:
-        {
-            statement->UnbindAllColumns();
+        return SQL_SUCCESS;
+    }
 
-            break;
-        }
+    SQLRETURN SQLCloseCursor(SQLHSTMT stmt)
+    {
+        using ignite::odbc::Statement;
 
-        case SQL_RESET_PARAMS:
-        {
-            statement->UnbindAllParameters();
+        LOG_MSG("SQLCloseCursor called\n");
 
-            break;
-        }
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-        default:
-            return SQL_ERROR;
-    }
+        statement->Close();
 
-    return SQL_SUCCESS;
-}
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-SQLRETURN SQL_API SQLCloseCursor(SQLHSTMT stmt)
-{
-    using ignite::odbc::Statement;
+    SQLRETURN SQLDriverConnect(SQLHDBC      conn,
+                               SQLHWND      windowHandle,
+                               SQLCHAR*     inConnectionString,
+                               SQLSMALLINT  inConnectionStringLen,
+                               SQLCHAR*     outConnectionString,
+                               SQLSMALLINT  outConnectionStringBufferLen,
+                               SQLSMALLINT* outConnectionStringLen,
+                               SQLUSMALLINT driverCompletion)
+    {
+        using ignite::odbc::Connection;
+        using ignite::odbc::diagnostic::DiagnosticRecordStorage;
+        using ignite::utility::SqlStringToString;
+        using ignite::utility::CopyStringToBuffer;
 
-    LOG_MSG("SQLCloseCursor called\n");
+        UNREFERENCED_PARAMETER(windowHandle);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        LOG_MSG("SQLDriverConnect called\n");
+        LOG_MSG("Connection String: [%s]\n", inConnectionString);
 
-    statement->Close();
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-SQLRETURN SQL_API SQLDriverConnect(SQLHDBC      conn,
-                                   SQLHWND      windowHandle,
-                                   SQLCHAR*     inConnectionString,
-                                   SQLSMALLINT  inConnectionStringLen,
-                                   SQLCHAR*     outConnectionString,
-                                   SQLSMALLINT  outConnectionStringBufferLen,
-                                   SQLSMALLINT* outConnectionStringLen,
-                                   SQLUSMALLINT driverCompletion)
-{
-    using ignite::odbc::Connection;
-    using ignite::odbc::diagnostic::DiagnosticRecordStorage;
-    using ignite::utility::SqlStringToString;
-    using ignite::utility::CopyStringToBuffer;
+        std::string connectStr = SqlStringToString(inConnectionString, inConnectionStringLen);
 
-    UNREFERENCED_PARAMETER(windowHandle);
+        ignite::odbc::config::Configuration config;
 
-    LOG_MSG("SQLDriverConnect called\n");
-    LOG_MSG("Connection String: [%s]\n", inConnectionString);
+        config.FillFromConnectString(connectStr);
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+        connection->Establish(config.GetHost(), config.GetPort(), config.GetCache());
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+        const DiagnosticRecordStorage& diag = connection->GetDiagnosticRecords();
 
-    std::string connectStr = SqlStringToString(inConnectionString, inConnectionStringLen);
+        if (!diag.IsSuccessful())
+            return diag.GetReturnCode();
 
-    ignite::odbc::config::Configuration config;
+        std::string outConnectStr = config.ToConnectString();
 
-    config.FillFromConnectString(connectStr);
+        size_t reslen = CopyStringToBuffer(outConnectStr,
+            reinterpret_cast<char*>(outConnectionString),
+            static_cast<size_t>(outConnectionStringBufferLen));
 
-    connection->Establish(config.GetHost(), config.GetPort(), config.GetCache());
+        if (outConnectionStringLen)
+            *outConnectionStringLen = static_cast<SQLSMALLINT>(reslen);
 
-    const DiagnosticRecordStorage& diag = connection->GetDiagnosticRecords();
+        LOG_MSG("%s\n", outConnectionString);
 
-    if (!diag.IsSuccessful())
         return diag.GetReturnCode();
+    }
 
-    std::string outConnectStr = config.ToConnectString();
-
-    size_t reslen = CopyStringToBuffer(outConnectStr,
-        reinterpret_cast<char*>(outConnectionString),
-        static_cast<size_t>(outConnectionStringBufferLen));
-
-    if (outConnectionStringLen)
-        *outConnectionStringLen = static_cast<SQLSMALLINT>(reslen);
+    SQLRETURN SQLConnect(SQLHDBC        conn,
+                         SQLCHAR*       serverName,
+                         SQLSMALLINT    serverNameLen,
+                         SQLCHAR*       userName,
+                         SQLSMALLINT    userNameLen,
+                         SQLCHAR*       auth,
+                         SQLSMALLINT    authLen)
+    {
+        using ignite::odbc::Connection;
+        using ignite::odbc::diagnostic::DiagnosticRecordStorage;
+        using ignite::utility::SqlStringToString;
 
-    LOG_MSG("%s\n", outConnectionString);
+        LOG_MSG("SQLConnect called\n");
 
-    return diag.GetReturnCode();
-}
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-SQLRETURN SQL_API SQLConnect(SQLHDBC        conn,
-                             SQLCHAR*       serverName,
-                             SQLSMALLINT    serverNameLen,
-                             SQLCHAR*       userName,
-                             SQLSMALLINT    userNameLen,
-                             SQLCHAR*       auth,
-                             SQLSMALLINT    authLen)
-{
-    using ignite::odbc::Connection;
-    using ignite::odbc::diagnostic::DiagnosticRecordStorage;
-    using ignite::utility::SqlStringToString;
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLConnect called\n");
+        std::string server = SqlStringToString(serverName, serverNameLen);
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+        connection->Establish(server);
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+        return connection->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    std::string server = SqlStringToString(serverName, serverNameLen);
+    SQLRETURN SQLDisconnect(SQLHDBC conn)
+    {
+        using ignite::odbc::Connection;
 
-    connection->Establish(server);
+        LOG_MSG("SQLDisconnect called\n");
 
-    return connection->GetDiagnosticRecords().GetReturnCode();
-}
+        Connection *connection = reinterpret_cast<Connection*>(conn);
 
-SQLRETURN SQL_API SQLDisconnect(SQLHDBC conn)
-{
-    using ignite::odbc::Connection;
+        if (!connection)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLDisconnect called\n");
+        connection->Release();
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+        return connection->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+    SQLRETURN SQLPrepare(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-    connection->Release();
+        LOG_MSG("SQLPrepare called\n");
 
-    return connection->GetDiagnosticRecords().GetReturnCode();
-}
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-SQLRETURN SQL_API SQLPrepare(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLPrepare called\n");
+        std::string sql = SqlStringToString(query, queryLen);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        LOG_MSG("SQL: %s\n", sql.c_str());
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        statement->PrepareSqlQuery(sql);
 
-    std::string sql = SqlStringToString(query, queryLen);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    LOG_MSG("SQL: %s\n", sql.c_str());
+    SQLRETURN SQLExecute(SQLHSTMT stmt)
+    {
+        using ignite::odbc::Statement;
 
-    statement->PrepareSqlQuery(sql);
+        LOG_MSG("SQLExecute called\n");
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-SQLRETURN SQL_API SQLExecute(SQLHSTMT stmt)
-{
-    using ignite::odbc::Statement;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLExecute called\n");
+        statement->ExecuteSqlQuery();
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+    SQLRETURN SQLExecDirect(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-    statement->ExecuteSqlQuery();
+        LOG_MSG("SQLExecDirect called\n");
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-SQLRETURN SQL_API SQLExecDirect(SQLHSTMT stmt, SQLCHAR* query, SQLINTEGER queryLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLExecDirect called\n");
+        std::string sql = SqlStringToString(query, queryLen);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        LOG_MSG("SQL: %s\n", sql.c_str());
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        statement->ExecuteSqlQuery(sql);
 
-    std::string sql = SqlStringToString(query, queryLen);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    LOG_MSG("SQL: %s\n", sql.c_str());
+    SQLRETURN SQLBindCol(SQLHSTMT       stmt,
+                         SQLUSMALLINT   colNum,
+                         SQLSMALLINT    targetType,
+                         SQLPOINTER     targetValue,
+                         SQLLEN         bufferLength,
+                         SQLLEN*        strLengthOrIndicator)
+    {
+        using namespace ignite::odbc::type_traits;
 
-    statement->ExecuteSqlQuery(sql);
+        using ignite::odbc::Statement;
+        using ignite::odbc::app::ApplicationDataBuffer;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        LOG_MSG("SQLBindCol called: index=%d, type=%d\n", colNum, targetType);
 
-SQLRETURN SQL_API SQLBindCol(SQLHSTMT       stmt,
-                             SQLUSMALLINT   colNum,
-                             SQLSMALLINT    targetType,
-                             SQLPOINTER     targetValue,
-                             SQLLEN         bufferLength,
-                             SQLLEN*        strLengthOrIndicator)
-{
-    using namespace ignite::odbc::type_traits;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    using ignite::odbc::Statement;
-    using ignite::odbc::app::ApplicationDataBuffer;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLBindCol called: index=%d, type=%d\n", colNum, targetType);
+        IgniteSqlType driverType = ToDriverType(targetType);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (driverType == IGNITE_ODBC_C_TYPE_UNSUPPORTED)
+            return SQL_ERROR;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        if (bufferLength < 0)
+            return SQL_ERROR;
 
-    IgniteSqlType driverType = ToDriverType(targetType);
+        if (targetValue || strLengthOrIndicator)
+        {
+            ApplicationDataBuffer dataBuffer(driverType, targetValue, bufferLength, strLengthOrIndicator);
 
-    if (driverType == IGNITE_ODBC_C_TYPE_UNSUPPORTED)
-        return SQL_ERROR;
+            statement->BindColumn(colNum, dataBuffer);
+        }
+        else
+            statement->UnbindColumn(colNum);
 
-    if (bufferLength < 0)
-        return SQL_ERROR;
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    if (targetValue || strLengthOrIndicator)
+    SQLRETURN SQLFetch(SQLHSTMT stmt)
     {
-        ApplicationDataBuffer dataBuffer(driverType, targetValue, bufferLength, strLengthOrIndicator);
+        using ignite::odbc::Statement;
 
-        statement->BindColumn(colNum, dataBuffer);
-    }
-    else
-        statement->UnbindColumn(colNum);
+        LOG_MSG("SQLFetch called\n");
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-SQLRETURN SQL_API SQLFetch(SQLHSTMT stmt)
-{
-    using ignite::odbc::Statement;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLFetch called\n");
+        statement->FetchRow();
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+    SQLRETURN SQLFetchScroll(SQLHSTMT stmt, SQLSMALLINT orientation, SQLLEN offset)
+    {
+        LOG_MSG("SQLFetchScroll called\n");
+        LOG_MSG("Orientation: %d, Offset: %d\n", orientation, offset);
 
-    statement->FetchRow();
+        if (orientation != SQL_FETCH_NEXT)
+            return SQL_ERROR;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        return SQLFetch(stmt);
+    }
 
-SQLRETURN SQL_API SQLFetchScroll(SQLHSTMT       stmt,
-                                 SQLSMALLINT    orientation,
-                                 SQLLEN         offset)
-{
-    LOG_MSG("SQLFetchScroll called\n");
-    LOG_MSG("Orientation: %d, Offset: %d\n", orientation, offset);
+    SQLRETURN SQLExtendedFetch(SQLHSTMT         stmt,
+                               SQLUSMALLINT     orientation,
+                               SQLLEN           offset,
+                               SQLULEN*         rowCount,
+                               SQLUSMALLINT*    rowStatusArray)
+    {
+        LOG_MSG("SQLExtendedFetch called\n");
 
-    if (orientation != SQL_FETCH_NEXT)
-        return SQL_ERROR;
+        SQLRETURN res = SQLFetchScroll(stmt, orientation, offset);
 
-    return SQLFetch(stmt);
-}
+        if (res == SQL_SUCCESS || res == SQL_NO_DATA)
+        {
+            if (rowCount)
+                *rowCount = 1;
 
-SQLRETURN SQL_API SQLExtendedFetch(SQLHSTMT         stmt,
-                                   SQLUSMALLINT     orientation,
-                                   SQLLEN           offset,
-                                   SQLULEN*         rowCount,
-                                   SQLUSMALLINT*    rowStatusArray)
-{
-    LOG_MSG("SQLExtendedFetch called\n");
+            if (rowStatusArray)
+                rowStatusArray[0] = SQL_ROW_SUCCESS;
+        }
 
-    SQLRETURN res = SQLFetchScroll(stmt, orientation, offset);
+        return res;
+    }
 
-    if (res == SQL_SUCCESS || res == SQL_NO_DATA)
+    SQLRETURN SQLNumResultCols(SQLHSTMT stmt, SQLSMALLINT *columnNum)
     {
-        if (rowCount)
-            *rowCount = 1;
+        using ignite::odbc::Statement;
+        using ignite::odbc::meta::ColumnMetaVector;
 
-        if (rowStatusArray)
-            rowStatusArray[0] = SQL_ROW_SUCCESS;
-    }
+        LOG_MSG("SQLNumResultCols called\n");
 
-    return res;
-}
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-SQLRETURN SQL_API SQLNumResultCols(SQLHSTMT stmt, SQLSMALLINT *columnNum)
-{
-    using ignite::odbc::Statement;
-    using ignite::odbc::meta::ColumnMetaVector;
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLNumResultCols called\n");
+        int32_t res = statement->GetColumnNumber();
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        *columnNum = static_cast<SQLSMALLINT>(res);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
-    
-    int32_t res = statement->GetColumnNumber();
+        LOG_MSG("columnNum: %d\n", *columnNum);
 
-    *columnNum = static_cast<SQLSMALLINT>(res);
-
-    LOG_MSG("columnNum: %d\n", *columnNum);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+    SQLRETURN SQLTables(SQLHSTMT    stmt,
+                        SQLCHAR*    catalogName,
+                        SQLSMALLINT catalogNameLen,
+                        SQLCHAR*    schemaName,
+                        SQLSMALLINT schemaNameLen,
+                        SQLCHAR*    tableName,
+                        SQLSMALLINT tableNameLen,
+                        SQLCHAR*    tableType,
+                        SQLSMALLINT tableTypeLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-SQLRETURN SQL_API SQLTables(SQLHSTMT    stmt,
-                            SQLCHAR*    catalogName,
-                            SQLSMALLINT catalogNameLen,
-                            SQLCHAR*    schemaName,
-                            SQLSMALLINT schemaNameLen,
-                            SQLCHAR*    tableName,
-                            SQLSMALLINT tableNameLen,
-                            SQLCHAR*    tableType,
-                            SQLSMALLINT tableTypeLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+        LOG_MSG("SQLTables called\n");
 
-    LOG_MSG("SQLTables called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        std::string catalog = SqlStringToString(catalogName, catalogNameLen);
+        std::string schema = SqlStringToString(schemaName, schemaNameLen);
+        std::string table = SqlStringToString(tableName, tableNameLen);
+        std::string tableTypeStr = SqlStringToString(tableType, tableTypeLen);
 
-    std::string catalog = SqlStringToString(catalogName, catalogNameLen);
-    std::string schema = SqlStringToString(schemaName, schemaNameLen);
-    std::string table = SqlStringToString(tableName, tableNameLen);
-    std::string tableTypeStr = SqlStringToString(tableType, tableTypeLen);
+        LOG_MSG("catalog: %s\n", catalog.c_str());
+        LOG_MSG("schema: %s\n", schema.c_str());
+        LOG_MSG("table: %s\n", table.c_str());
+        LOG_MSG("tableType: %s\n", tableTypeStr.c_str());
 
-    LOG_MSG("catalog: %s\n", catalog.c_str());
-    LOG_MSG("schema: %s\n", schema.c_str());
-    LOG_MSG("table: %s\n", table.c_str());
-    LOG_MSG("tableType: %s\n", tableTypeStr.c_str());
+        statement->ExecuteGetTablesMetaQuery(catalog, schema, table, tableTypeStr);
 
-    statement->ExecuteGetTablesMetaQuery(catalog, schema, table, tableTypeStr);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+    SQLRETURN SQLColumns(SQLHSTMT       stmt,
+                         SQLCHAR*       catalogName,
+                         SQLSMALLINT    catalogNameLen,
+                         SQLCHAR*       schemaName,
+                         SQLSMALLINT    schemaNameLen,
+                         SQLCHAR*       tableName,
+                         SQLSMALLINT    tableNameLen,
+                         SQLCHAR*       columnName,
+                         SQLSMALLINT    columnNameLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-SQLRETURN SQL_API SQLColumns(SQLHSTMT       stmt,
-                             SQLCHAR*       catalogName,
-                             SQLSMALLINT    catalogNameLen,
-                             SQLCHAR*       schemaName,
-                             SQLSMALLINT    schemaNameLen,
-                             SQLCHAR*       tableName,
-                             SQLSMALLINT    tableNameLen,
-                             SQLCHAR*       columnName,
-                             SQLSMALLINT    columnNameLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+        LOG_MSG("SQLColumns called\n");
 
-    LOG_MSG("SQLColumns called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        std::string catalog = SqlStringToString(catalogName, catalogNameLen);
+        std::string schema = SqlStringToString(schemaName, schemaNameLen);
+        std::string table = SqlStringToString(tableName, tableNameLen);
+        std::string column = SqlStringToString(columnName, columnNameLen);
 
-    std::string catalog = SqlStringToString(catalogName, catalogNameLen);
-    std::string schema = SqlStringToString(schemaName, schemaNameLen);
-    std::string table = SqlStringToString(tableName, tableNameLen);
-    std::string column = SqlStringToString(columnName, columnNameLen);
+        LOG_MSG("catalog: %s\n", catalog.c_str());
+        LOG_MSG("schema: %s\n", schema.c_str());
+        LOG_MSG("table: %s\n", table.c_str());
+        LOG_MSG("column: %s\n", column.c_str());
 
-    LOG_MSG("catalog: %s\n", catalog.c_str());
-    LOG_MSG("schema: %s\n", schema.c_str());
-    LOG_MSG("table: %s\n", table.c_str());
-    LOG_MSG("column: %s\n", column.c_str());
+        statement->ExecuteGetColumnsMetaQuery(schema, table, column);
 
-    statement->ExecuteGetColumnsMetaQuery(schema, table, column);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+    SQLRETURN SQLMoreResults(SQLHSTMT stmt)
+    {
+        using ignite::odbc::Statement;
 
-SQLRETURN SQL_API SQLMoreResults(SQLHSTMT stmt)
-{
-    using ignite::odbc::Statement;
+        LOG_MSG("SQLMoreResults called\n");
 
-    LOG_MSG("SQLMoreResults called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        //TODO: reset diagnostic here.
+        return statement->DataAvailable() ? SQL_SUCCESS : SQL_NO_DATA;
+    }
 
-    //TODO: reset diagnostic here.
-    return statement->DataAvailable() ? SQL_SUCCESS : SQL_NO_DATA;
-}
+    SQLRETURN SQLBindParameter(SQLHSTMT     stmt,
+                               SQLUSMALLINT paramIdx,
+                               SQLSMALLINT  ioType,
+                               SQLSMALLINT  bufferType,
+                               SQLSMALLINT  paramSqlType,
+                               SQLULEN      columnSize,
+                               SQLSMALLINT  decDigits,
+                               SQLPOINTER   buffer,
+                               SQLLEN       bufferLen,
+                               SQLLEN*      resLen)
+    {
+        using namespace ignite::odbc::type_traits;
 
-SQLRETURN SQL_API SQLBindParameter(SQLHSTMT     stmt,
-                                   SQLUSMALLINT paramIdx,
-                                   SQLSMALLINT  ioType,
-                                   SQLSMALLINT  bufferType,
-                                   SQLSMALLINT  paramSqlType,
-                                   SQLULEN      columnSize,
-                                   SQLSMALLINT  decDigits,
-                                   SQLPOINTER   buffer,
-                                   SQLLEN       bufferLen,
-                                   SQLLEN*      resLen)
-{
-    using namespace ignite::odbc::type_traits;
+        using ignite::odbc::Statement;
+        using ignite::odbc::app::ApplicationDataBuffer;
+        using ignite::odbc::app::Parameter;
+        using ignite::odbc::type_traits::IsSqlTypeSupported;
 
-    using ignite::odbc::Statement;
-    using ignite::odbc::app::ApplicationDataBuffer;
-    using ignite::odbc::app::Parameter;
-    using ignite::odbc::type_traits::IsSqlTypeSupported;
+        LOG_MSG("SQLBindParameter called\n");
 
-    LOG_MSG("SQLBindParameter called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        if (ioType != SQL_PARAM_INPUT)
+            return SQL_ERROR;
 
-    if (ioType != SQL_PARAM_INPUT)
-        return SQL_ERROR;
+        if (*resLen == SQL_DATA_AT_EXEC || *resLen <= SQL_LEN_DATA_AT_EXEC_OFFSET)
+            return SQL_ERROR;
 
-    if (*resLen == SQL_DATA_AT_EXEC || *resLen <= SQL_LEN_DATA_AT_EXEC_OFFSET)
-        return SQL_ERROR;
+        if (!IsSqlTypeSupported(paramSqlType))
+            return SQL_ERROR;
 
-    if (!IsSqlTypeSupported(paramSqlType))
-        return SQL_ERROR;
+        IgniteSqlType driverType = ToDriverType(bufferType);
 
-    IgniteSqlType driverType = ToDriverType(bufferType);
+        if (driverType == IGNITE_ODBC_C_TYPE_UNSUPPORTED)
+            return SQL_ERROR;
 
-    if (driverType == IGNITE_ODBC_C_TYPE_UNSUPPORTED)
-        return SQL_ERROR;
+        if (buffer)
+        {
+            ApplicationDataBuffer dataBuffer(driverType, buffer, bufferLen, resLen);
 
-    if (buffer)
-    {
-        ApplicationDataBuffer dataBuffer(driverType, buffer, bufferLen, resLen);
+            Parameter param(dataBuffer, paramSqlType, columnSize, decDigits);
 
-        Parameter param(dataBuffer, paramSqlType, columnSize, decDigits);
+            statement->BindParameter(paramIdx, param);
+        }
+        else
+            statement->UnbindParameter(paramIdx);
 
-        statement->BindParameter(paramIdx, param);
+        return statement->GetDiagnosticRecords().GetReturnCode();
     }
-    else
-        statement->UnbindParameter(paramIdx);
-
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
-
-SQLRETURN SQL_API SQLNativeSql(SQLHDBC      conn,
-                               SQLCHAR*     inQuery,
-                               SQLINTEGER   inQueryLen,
-                               SQLCHAR*     outQueryBuffer,
-                               SQLINTEGER   outQueryBufferLen,
-                               SQLINTEGER*  outQueryLen)
-{
-    using namespace ignite::utility;
-
-    LOG_MSG("SQLNativeSql called\n");
-
-    std::string in = SqlStringToString(inQuery, inQueryLen);
-
-    CopyStringToBuffer(in, reinterpret_cast<char*>(outQueryBuffer),
-        static_cast<size_t>(outQueryBufferLen));
 
-    *outQueryLen = std::min(outQueryBufferLen, static_cast<SQLINTEGER>(in.size()));
+    SQLRETURN SQLNativeSql(SQLHDBC      conn,
+                           SQLCHAR*     inQuery,
+                           SQLINTEGER   inQueryLen,
+                           SQLCHAR*     outQueryBuffer,
+                           SQLINTEGER   outQueryBufferLen,
+                           SQLINTEGER*  outQueryLen)
+    {
+        using namespace ignite::utility;
 
-    return SQL_SUCCESS;
-}
+        LOG_MSG("SQLNativeSql called\n");
 
-SQLRETURN SQL_API SQLColAttribute(SQLHSTMT        stmt,
-                                  SQLUSMALLINT    columnNum,
-                                  SQLUSMALLINT    fieldId,
-                                  SQLPOINTER      strAttr,
-                                  SQLSMALLINT     bufferLen,
-                                  SQLSMALLINT*    strAttrLen,
-                                  SQLLEN*         numericAttr)
-{
-    using ignite::odbc::Statement;
-    using ignite::odbc::meta::ColumnMetaVector;
-    using ignite::odbc::meta::ColumnMeta;
+        std::string in = SqlStringToString(inQuery, inQueryLen);
 
-    LOG_MSG("SQLColAttribute called: %d (%s)\n", fieldId, ColumnMeta::AttrIdToString(fieldId));
+        CopyStringToBuffer(in, reinterpret_cast<char*>(outQueryBuffer),
+            static_cast<size_t>(outQueryBufferLen));
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        *outQueryLen = std::min(outQueryBufferLen, static_cast<SQLINTEGER>(in.size()));
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        return SQL_SUCCESS;
+    }
 
-    // This is a special case
-    if (fieldId == SQL_DESC_COUNT)
+    SQLRETURN SQLColAttribute(SQLHSTMT        stmt,
+                              SQLUSMALLINT    columnNum,
+                              SQLUSMALLINT    fieldId,
+                              SQLPOINTER      strAttr,
+                              SQLSMALLINT     bufferLen,
+                              SQLSMALLINT*    strAttrLen,
+                              SQLLEN*         numericAttr)
     {
-        SQLSMALLINT val = 0;
+        using ignite::odbc::Statement;
+        using ignite::odbc::meta::ColumnMetaVector;
+        using ignite::odbc::meta::ColumnMeta;
 
-        SQLRETURN res = SQLNumResultCols(stmt, &val);
+        LOG_MSG("SQLColAttribute called: %d (%s)\n", fieldId, ColumnMeta::AttrIdToString(fieldId));
 
-        if (res == SQL_SUCCESS)
-            *numericAttr = val;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-        return res;
-    }
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    statement->GetColumnAttribute(columnNum, fieldId, reinterpret_cast<char*>(strAttr),
-        bufferLen, strAttrLen, numericAttr);
-
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
-
-SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT       stmt,
-                                 SQLUSMALLINT   columnNum, 
-                                 SQLCHAR*       columnNameBuf,
-                                 SQLSMALLINT    columnNameBufLen,
-                                 SQLSMALLINT*   columnNameLen,
-                                 SQLSMALLINT*   dataType, 
-                                 SQLULEN*       columnSize,
-                                 SQLSMALLINT*   decimalDigits, 
-                                 SQLSMALLINT*   nullable)
-{
-    using ignite::odbc::Statement;
-    using ignite::odbc::SqlLen;
+        // This is a special case
+        if (fieldId == SQL_DESC_COUNT)
+        {
+            SQLSMALLINT val = 0;
 
-    LOG_MSG("SQLDescribeCol called\n");
+            SQLRETURN res = SQLNumResultCols(stmt, &val);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+            if (res == SQL_SUCCESS)
+                *numericAttr = val;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+            return res;
+        }
 
-    statement->GetColumnAttribute(columnNum, SQL_DESC_NAME,
-        reinterpret_cast<char*>(columnNameBuf), columnNameBufLen, columnNameLen, 0);
+        statement->GetColumnAttribute(columnNum, fieldId, reinterpret_cast<char*>(strAttr),
+            bufferLen, strAttrLen, numericAttr);
 
-    SqlLen dataTypeRes;
-    SqlLen columnSizeRes;
-    SqlLen decimalDigitsRes;
-    SqlLen nullableRes;
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    statement->GetColumnAttribute(columnNum, SQL_DESC_TYPE, 0, 0, 0, &dataTypeRes);
-    statement->GetColumnAttribute(columnNum, SQL_DESC_PRECISION, 0, 0, 0, &columnSizeRes);
-    statement->GetColumnAttribute(columnNum, SQL_DESC_SCALE, 0, 0, 0, &decimalDigitsRes);
-    statement->GetColumnAttribute(columnNum, SQL_DESC_NULLABLE, 0, 0, 0, &nullableRes);
+    SQLRETURN SQLDescribeCol(SQLHSTMT       stmt,
+                             SQLUSMALLINT   columnNum, 
+                             SQLCHAR*       columnNameBuf,
+                             SQLSMALLINT    columnNameBufLen,
+                             SQLSMALLINT*   columnNameLen,
+                             SQLSMALLINT*   dataType, 
+                             SQLULEN*       columnSize,
+                             SQLSMALLINT*   decimalDigits, 
+                             SQLSMALLINT*   nullable)
+    {
+        using ignite::odbc::Statement;
+        using ignite::odbc::SqlLen;
 
-    LOG_MSG("columnNum: %lld\n", columnNum);
-    LOG_MSG("dataTypeRes: %lld\n", dataTypeRes);
-    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("SQLDescribeCol called\n");
 
-    *dataType = static_cast<SQLSMALLINT>(dataTypeRes);
-    *columnSize = static_cast<SQLULEN>(columnSizeRes);
-    *decimalDigits = static_cast<SQLSMALLINT>(decimalDigitsRes);
-    *nullable = static_cast<SQLSMALLINT>(nullableRes);
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
+        statement->GetColumnAttribute(columnNum, SQL_DESC_NAME,
+            reinterpret_cast<char*>(columnNameBuf), columnNameBufLen, columnNameLen, 0);
 
-SQLRETURN SQL_API SQLRowCount(SQLHSTMT stmt, SQLLEN* rowCnt)
-{
-    using ignite::odbc::Statement;
+        SqlLen dataTypeRes;
+        SqlLen columnSizeRes;
+        SqlLen decimalDigitsRes;
+        SqlLen nullableRes;
 
-    LOG_MSG("SQLRowCount called\n");
+        statement->GetColumnAttribute(columnNum, SQL_DESC_TYPE, 0, 0, 0, &dataTypeRes);
+        statement->GetColumnAttribute(columnNum, SQL_DESC_PRECISION, 0, 0, 0, &columnSizeRes);
+        statement->GetColumnAttribute(columnNum, SQL_DESC_SCALE, 0, 0, 0, &decimalDigitsRes);
+        statement->GetColumnAttribute(columnNum, SQL_DESC_NULLABLE, 0, 0, 0, &nullableRes);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        LOG_MSG("columnNum: %lld\n", columnNum);
+        LOG_MSG("dataTypeRes: %lld\n", dataTypeRes);
+        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);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        *dataType = static_cast<SQLSMALLINT>(dataTypeRes);
+        *columnSize = static_cast<SQLULEN>(columnSizeRes);
+        *decimalDigits = static_cast<SQLSMALLINT>(decimalDigitsRes);
+        *nullable = static_cast<SQLSMALLINT>(nullableRes);
 
-    int64_t res = statement->AffectedRows();
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    *rowCnt = static_cast<SQLLEN>(res);
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+    SQLRETURN SQLRowCount(SQLHSTMT stmt, SQLLEN* rowCnt)
+    {
+        using ignite::odbc::Statement;
 
-SQLRETURN SQL_API SQLForeignKeys(SQLHSTMT       stmt,
-                                 SQLCHAR*       primaryCatalogName,
-                                 SQLSMALLINT    primaryCatalogNameLen,
-                                 SQLCHAR*       primarySchemaName,
-                                 SQLSMALLINT    primarySchemaNameLen,
-                                 SQLCHAR*       primaryTableName,
-                                 SQLSMALLINT    primaryTableNameLen,
-                                 SQLCHAR*       foreignCatalogName,
-                                 SQLSMALLINT    foreignCatalogNameLen,
-                                 SQLCHAR*       foreignSchemaName,
-                                 SQLSMALLINT    foreignSchemaNameLen,
-                                 SQLCHAR*       foreignTableName,
-                                 SQLSMALLINT    foreignTableNameLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+        LOG_MSG("SQLRowCount called\n");
 
-    LOG_MSG("SQLForeignKeys called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        int64_t res = statement->AffectedRows();
 
-    std::string primaryCatalog = SqlStringToString(primaryCatalogName, primaryCatalogNameLen);
-    std::string primarySchema = SqlStringToString(primarySchemaName, primarySchemaNameLen);
-    std::string primaryTable = SqlStringToString(primaryTableName, primaryTableNameLen);
-    std::string foreignCatalog = SqlStringToString(foreignCatalogName, foreignCatalogNameLen);
-    std::string foreignSchema = SqlStringToString(foreignSchemaName, foreignSchemaNameLen);
-    std::string foreignTable = SqlStringToString(foreignTableName, foreignTableNameLen);
+        *rowCnt = static_cast<SQLLEN>(res);
 
-    LOG_MSG("primaryCatalog: %s\n", primaryCatalog.c_str());
-    LOG_MSG("primarySchema: %s\n", primarySchema.c_str());
-    LOG_MSG("primaryTable: %s\n", primaryTable.c_str());
-    LOG_MSG("foreignCatalog: %s\n", foreignCatalog.c_str());
-    LOG_MSG("foreignSchema: %s\n", foreignSchema.c_str());
-    LOG_MSG("foreignTable: %s\n", foreignTable.c_str());
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    statement->ExecuteGetForeignKeysQuery(primaryCatalog, primarySchema,
-        primaryTable, foreignCatalog, foreignSchema, foreignTable);
+    SQLRETURN SQLForeignKeys(SQLHSTMT       stmt,
+                             SQLCHAR*       primaryCatalogName,
+                             SQLSMALLINT    primaryCatalogNameLen,
+                             SQLCHAR*       primarySchemaName,
+                             SQLSMALLINT    primarySchemaNameLen,
+                             SQLCHAR*       primaryTableName,
+                             SQLSMALLINT    primaryTableNameLen,
+                             SQLCHAR*       foreignCatalogName,
+                             SQLSMALLINT    foreignCatalogNameLen,
+                             SQLCHAR*       foreignSchemaName,
+                             SQLSMALLINT    foreignSchemaNameLen,
+                             SQLCHAR*       foreignTableName,
+                             SQLSMALLINT    foreignTableNameLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        LOG_MSG("SQLForeignKeys called\n");
 
-SQLRETURN SQL_API SQLGetStmtAttr(SQLHSTMT       stmt,
-                                 SQLINTEGER     attr,
-                                 SQLPOINTER     valueBuf,
-                                 SQLINTEGER     valueBufLen,
-                                 SQLINTEGER*    valueResLen)
-{
-    using ignite::odbc::Statement;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    LOG_MSG("SQLGetStmtAttr called");
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-#ifdef ODBC_DEBUG
-    using ignite::odbc::type_traits::StatementAttrIdToString;
+        std::string primaryCatalog = SqlStringToString(primaryCatalogName, primaryCatalogNameLen);
+        std::string primarySchema = SqlStringToString(primarySchemaName, primarySchemaNameLen);
+        std::string primaryTable = SqlStringToString(primaryTableName, primaryTableNameLen);
+        std::string foreignCatalog = SqlStringToString(foreignCatalogName, foreignCatalogNameLen);
+        std::string foreignSchema = SqlStringToString(foreignSchemaName, foreignSchemaNameLen);
+        std::string foreignTable = SqlStringToString(foreignTableName, foreignTableNameLen);
 
-    LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
-#endif //ODBC_DEBUG
+        LOG_MSG("primaryCatalog: %s\n", primaryCatalog.c_str());
+        LOG_MSG("primarySchema: %s\n", primarySchema.c_str());
+        LOG_MSG("primaryTable: %s\n", primaryTable.c_str());
+        LOG_MSG("foreignCatalog: %s\n", foreignCatalog.c_str());
+        LOG_MSG("foreignSchema: %s\n", foreignSchema.c_str());
+        LOG_MSG("foreignTable: %s\n", foreignTable.c_str());
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        statement->ExecuteGetForeignKeysQuery(primaryCatalog, primarySchema,
+            primaryTable, foreignCatalog, foreignSchema, foreignTable);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    //TODO: move this logic into Statement.
-    switch (attr)
+    SQLRETURN SQLGetStmtAttr(SQLHSTMT       stmt,
+                             SQLINTEGER     attr,
+                             SQLPOINTER     valueBuf,
+                             SQLINTEGER     valueBufLen,
+                             SQLINTEGER*    valueResLen)
     {
-        case SQL_ATTR_APP_ROW_DESC:
-        case SQL_ATTR_APP_PARAM_DESC:
-        case SQL_ATTR_IMP_ROW_DESC:
-        case SQL_ATTR_IMP_PARAM_DESC:
-        {
-            SQLPOINTER *val = reinterpret_cast<SQLPOINTER*>(valueBuf);
+        using ignite::odbc::Statement;
 
-            *val = static_cast<SQLPOINTER>(stmt);
+        LOG_MSG("SQLGetStmtAttr called");
 
-            break;
-        }
+    #ifdef ODBC_DEBUG
+        using ignite::odbc::type_traits::StatementAttrIdToString;
 
-        case SQL_ATTR_ROW_ARRAY_SIZE:
-        {
-            SQLINTEGER *val = reinterpret_cast<SQLINTEGER*>(valueBuf);
+        LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
+    #endif //ODBC_DEBUG
 
-            *val = static_cast<SQLINTEGER>(1);
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-            break;
-        }
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-        case SQL_ATTR_ROWS_FETCHED_PTR:
+        //TODO: move this logic into Statement.
+        switch (attr)
         {
-            SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
+            case SQL_ATTR_APP_ROW_DESC:
+            case SQL_ATTR_APP_PARAM_DESC:
+            case SQL_ATTR_IMP_ROW_DESC:
+            case SQL_ATTR_IMP_PARAM_DESC:
+            {
+                SQLPOINTER *val = reinterpret_cast<SQLPOINTER*>(valueBuf);
 
-            *val = reinterpret_cast<SQLULEN*>(statement->GetRowsFetchedPtr());
+                *val = static_cast<SQLPOINTER>(stmt);
 
-            break;
-        }
+                break;
+            }
 
-        case SQL_ATTR_ROW_STATUS_PTR:
-        {
-            SQLUSMALLINT** val = reinterpret_cast<SQLUSMALLINT**>(valueBuf);
+            case SQL_ATTR_ROW_ARRAY_SIZE:
+            {
+                SQLINTEGER *val = reinterpret_cast<SQLINTEGER*>(valueBuf);
 
-            *val = reinterpret_cast<SQLUSMALLINT*>(statement->GetRowStatusesPtr());
+                *val = static_cast<SQLINTEGER>(1);
 
-            break;
-        }
+                break;
+            }
 
-        case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
-        {
-            SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
+            case SQL_ATTR_ROWS_FETCHED_PTR:
+            {
+                SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
 
-            *val = reinterpret_cast<SQLULEN*>(statement->GetParamBindOffsetPtr());
+                *val = reinterpret_cast<SQLULEN*>(statement->GetRowsFetchedPtr());
 
-            break;
-        }
+                break;
+            }
 
-        case SQL_ATTR_ROW_BIND_OFFSET_PTR:
-        {
-            SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
+            case SQL_ATTR_ROW_STATUS_PTR:
+            {
+                SQLUSMALLINT** val = reinterpret_cast<SQLUSMALLINT**>(valueBuf);
 
-            *val = reinterpret_cast<SQLULEN*>(statement->GetColumnBindOffsetPtr());
+                *val = reinterpret_cast<SQLUSMALLINT*>(statement->GetRowStatusesPtr());
 
-            break;
-        }
+                break;
+            }
 
-        default:
-            return SQL_ERROR;
-    }
+            case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
+            {
+                SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
 
-    return SQL_SUCCESS;
-}
+                *val = reinterpret_cast<SQLULEN*>(statement->GetParamBindOffsetPtr());
 
-SQLRETURN SQL_API SQLSetStmtAttr(SQLHSTMT    stmt,
-                                 SQLINTEGER  attr,
-                                 SQLPOINTER  value,
-                                 SQLINTEGER  valueLen)
-{
-    using ignite::odbc::Statement;
+                break;
+            }
 
-    LOG_MSG("SQLSetStmtAttr called");
+            case SQL_ATTR_ROW_BIND_OFFSET_PTR:
+            {
+                SQLULEN** val = reinterpret_cast<SQLULEN**>(valueBuf);
 
-#ifdef ODBC_DEBUG
-    using ignite::odbc::type_traits::StatementAttrIdToString;
+                *val = reinterpret_cast<SQLULEN*>(statement->GetColumnBindOffsetPtr());
 
-    LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
-#endif //ODBC_DEBUG
+                break;
+            }
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+            default:
+                return SQL_ERROR;
+        }
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        return SQL_SUCCESS;
+    }
 
-    //TODO: move this logic into Statement.
-    switch (attr)
+    SQLRETURN SQLSetStmtAttr(SQLHSTMT    stmt,
+                             SQLINTEGER  attr,
+                             SQLPOINTER  value,
+                             SQLINTEGER  valueLen)
     {
-        case SQL_ATTR_ROW_ARRAY_SIZE:
-        {
-            SQLULEN val = reinterpret_cast<SQLULEN>(value);
+        using ignite::odbc::Statement;
 
-            LOG_MSG("Value: %d\n", val);
+        LOG_MSG("SQLSetStmtAttr called");
 
-            if (val != 1)
-                return SQL_ERROR;
+    #ifdef ODBC_DEBUG
+        using ignite::odbc::type_traits::StatementAttrIdToString;
 
-            break;
-        }
+        LOG_MSG("Attr: %s (%d)\n", StatementAttrIdToString(attr), attr);
+    #endif //ODBC_DEBUG
 
-        case SQL_ATTR_ROWS_FETCHED_PTR:
-        {
-            statement->SetRowsFetchedPtr(reinterpret_cast<size_t*>(value));
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-            break;
-        }
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-        case SQL_ATTR_ROW_STATUS_PTR:
+        //TODO: move this logic into Statement.
+        switch (attr)
         {
-            statement->SetRowStatusesPtr(reinterpret_cast<uint16_t*>(value));
+            case SQL_ATTR_ROW_ARRAY_SIZE:
+            {
+                SQLULEN val = reinterpret_cast<SQLULEN>(value);
 
-            break;
-        }
+                LOG_MSG("Value: %d\n", val);
 
-        case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
-        {
-            statement->SetParamBindOffsetPtr(reinterpret_cast<size_t*>(value));
+                if (val != 1)
+                    return SQL_ERROR;
 
-            break;
-        }
+                break;
+            }
 
-        case SQL_ATTR_ROW_BIND_OFFSET_PTR:
-        {
-            statement->SetColumnBindOffsetPtr(reinterpret_cast<size_t*>(value));
+            case SQL_ATTR_ROWS_FETCHED_PTR:
+            {
+                statement->SetRowsFetchedPtr(reinterpret_cast<size_t*>(value));
 
-            break;
-        }
+                break;
+            }
 
-        default:
-            return SQL_ERROR;
-    }
+            case SQL_ATTR_ROW_STATUS_PTR:
+            {
+                statement->SetRowStatusesPtr(reinterpret_cast<uint16_t*>(value));
 
-    return SQL_SUCCESS;
-}
+                break;
+            }
 
-SQLRETURN SQL_API SQLPrimaryKeys(SQLHSTMT       stmt,
-                                 SQLCHAR*       catalogName,
-                                 SQLSMALLINT    catalogNameLen,
-                                 SQLCHAR*       schemaName,
-                                 SQLSMALLINT    schemaNameLen,
-                                 SQLCHAR*       tableName,
-                                 SQLSMALLINT    tableNameLen)
-{
-    using ignite::odbc::Statement;
-    using ignite::utility::SqlStringToString;
+            case SQL_ATTR_PARAM_BIND_OFFSET_PTR:
+            {
+                statement->SetParamBindOffsetPtr(reinterpret_cast<size_t*>(value));
 
-    LOG_MSG("SQLPrimaryKeys called\n");
+                break;
+            }
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+            case SQL_ATTR_ROW_BIND_OFFSET_PTR:
+            {
+                statement->SetColumnBindOffsetPtr(reinterpret_cast<size_t*>(value));
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+                break;
+            }
 
-    std::string catalog = SqlStringToString(catalogName, catalogNameLen);
-    std::string schema = SqlStringToString(schemaName, schemaNameLen);
-    std::string table = SqlStringToString(tableName, tableNameLen);
+            default:
+                return SQL_ERROR;
+        }
 
-    LOG_MSG("catalog: %s\n", catalog.c_str());
-    LOG_MSG("schema: %s\n", schema.c_str());
-    LOG_MSG("table: %s\n", table.c_str());
+        return SQL_SUCCESS;
+    }
 
-    statement->ExecuteGetPrimaryKeysQuery(catalog, schema, table);
+    SQLRETURN SQLPrimaryKeys(SQLHSTMT       stmt,
+                             SQLCHAR*       catalogName,
+                             SQLSMALLINT    catalogNameLen,
+                             SQLCHAR*       schemaName,
+                             SQLSMALLINT    schemaNameLen,
+                             SQLCHAR*       tableName,
+                             SQLSMALLINT    tableNameLen)
+    {
+        using ignite::odbc::Statement;
+        using ignite::utility::SqlStringToString;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        LOG_MSG("SQLPrimaryKeys called\n");
 
-SQLRETURN SQL_API SQLNumParams(SQLHSTMT stmt, SQLSMALLINT* paramCnt)
-{
-    using ignite::odbc::Statement;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    LOG_MSG("SQLNumParams called\n");
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        std::string catalog = SqlStringToString(catalogName, catalogNameLen);
+        std::string schema = SqlStringToString(schemaName, schemaNameLen);
+        std::string table = SqlStringToString(tableName, tableNameLen);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        LOG_MSG("catalog: %s\n", catalog.c_str());
+        LOG_MSG("schema: %s\n", schema.c_str());
+        LOG_MSG("table: %s\n", table.c_str());
 
-    *paramCnt = static_cast<SQLSMALLINT>(statement->GetParametersNumber());
+        statement->ExecuteGetPrimaryKeysQuery(catalog, schema, table);
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-SQLRETURN SQL_API SQLGetDiagField(SQLSMALLINT   handleType,
-                                  SQLHANDLE     handle,
-                                  SQLSMALLINT   recNum,
-                                  SQLSMALLINT   diagId,
-                                  SQLPOINTER    buffer,
-                                  SQLSMALLINT   bufferLen,
-                                  SQLSMALLINT*  resLen)
-{
-    using namespace ignite::odbc;
-    using namespace ignite::odbc::diagnostic;
-    using namespace ignite::odbc::type_traits;
+    SQLRETURN SQLNumParams(SQLHSTMT stmt, SQLSMALLINT* paramCnt)
+    {
+        using ignite::odbc::Statement;
 
-    using ignite::odbc::app::ApplicationDataBuffer;
+        LOG_MSG("SQLNumParams called\n");
 
-    LOG_MSG("SQLGetDiagField called: %d\n", recNum);
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    SqlLen outResLen;
-    ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, buffer, bufferLen, &outResLen);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    SqlResult result;
+        *paramCnt = static_cast<SQLSMALLINT>(statement->GetParametersNumber());
 
-    DiagnosticField field = DiagnosticFieldToInternal(diagId);
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    switch (handleType)
+    SQLRETURN SQLGetDiagField(SQLSMALLINT   handleType,
+                              SQLHANDLE     handle,
+                              SQLSMALLINT   recNum,
+                              SQLSMALLINT   diagId,
+                              SQLPOINTER    buffer,
+                              SQLSMALLINT   bufferLen,
+                              SQLSMALLINT*  resLen)
     {
-        case SQL_HANDLE_ENV:
-        case SQL_HANDLE_DBC:
-        case SQL_HANDLE_STMT:
-        {
-            Diagnosable *diag = reinterpret_cast<Diagnosable*>(handle);
+        using namespace ignite::odbc;
+        using namespace ignite::odbc::diagnostic;
+        using namespace ignite::odbc::type_traits;
 
-            result = diag->GetDiagnosticRecords().GetField(recNum, field, outBuffer);
+        using ignite::odbc::app::ApplicationDataBuffer;
 
-            break;
-        }
+        LOG_MSG("SQLGetDiagField called: %d\n", recNum);
 
-        default:
-        {
-            result = SQL_RESULT_NO_DATA;
-            break;
-        }
-    }
+        SqlLen outResLen;
+        ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, buffer, bufferLen, &outResLen);
 
-    if (result == SQL_RESULT_SUCCESS)
-        *resLen = static_cast<SQLSMALLINT>(outResLen);
+        SqlResult result;
 
-    return SqlResultToReturnCode(result);
-}
+        DiagnosticField field = DiagnosticFieldToInternal(diagId);
 
-SQLRETURN SQL_API SQLGetDiagRec(SQLSMALLINT     handleType,
-                                SQLHANDLE       handle,
-                                SQLSMALLINT     recNum,
-                                SQLCHAR*        sqlState,
-                                SQLINTEGER*     nativeError,
-                                SQLCHAR*        msgBuffer,
-                                SQLSMALLINT     msgBufferLen,
-                                SQLSMALLINT*    msgLen)
-{
-    using namespace ignite::utility;
-    using namespace ignite::odbc;
-    using namespace ignite::odbc::diagnostic;
-    using namespace ignite::odbc::type_traits;
-
-    using ignite::odbc::app::ApplicationDataBuffer;
-
-    LOG_MSG("SQLGetDiagRec called\n");
-
-    const DiagnosticRecordStorage* records = 0;
-    
-    switch (handleType)
-    {
-        case SQL_HANDLE_ENV:
-        case SQL_HANDLE_DBC:
-        case SQL_HANDLE_STMT:
+        switch (handleType)
         {
-            Diagnosable *diag = reinterpret_cast<Diagnosable*>(handle);
-
-            records = &diag->GetDiagnosticRecords();
-
-            break;
+            case SQL_HANDLE_ENV:
+            case SQL_HANDLE_DBC:
+            case SQL_HANDLE_STMT:
+            {
+                Diagnosable *diag = reinterpret_cast<Diagnosable*>(handle);
+
+                result = diag->GetDiagnosticRecords().GetField(recNum, field, outBuffer);
+
+                break;
+            }
+
+            default:
+            {
+                result = SQL_RESULT_NO_DATA;
+                break;
+            }
         }
 
-        default:
-            break;
-    }
+        if (result == SQL_RESULT_SUCCESS)
+            *resLen = static_cast<SQLSMALLINT>(outResLen);
 
-    if (!records || recNum < 1 || recNum > records->GetStatusRecordsNumber())
-        return SQL_NO_DATA;
+        return SqlResultToReturnCode(result);
+    }
 
-    const DiagnosticRecord& record = records->GetStatusRecord(recNum);
+    SQLRETURN SQLGetDiagRec(SQLSMALLINT     handleType,
+                            SQLHANDLE       handle,
+                            SQLSMALLINT     recNum,
+                            SQLCHAR*        sqlState,
+                            SQLINTEGER*     nativeError,
+                            SQLCHAR*        msgBuffer,
+                            SQLSMALLINT     msgBufferLen,
+                            SQLSMALLINT*    msgLen)
+    {
+        using namespace ignite::utility;
+        using namespace ignite::odbc;
+        using namespace ignite::odbc::diagnostic;
+        using namespace ignite::odbc::type_traits;
 
-    if (sqlState)
-        CopyStringToBuffer(record.GetSqlState(), reinterpret_cast<char*>(sqlState), 6);
+        using ignite::odbc::app::ApplicationDataBuffer;
 
-    if (nativeError)
-        *nativeError = 0;
+        LOG_MSG("SQLGetDiagRec called\n");
 
-    SqlLen outResLen;
-    ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuffer, msgBufferLen, &outResLen);
+        const DiagnosticRecordStorage* records = 0;
 
-    outBuffer.PutString(record.GetMessage());
+        switch (handleType)
+        {
+            case SQL_HANDLE_ENV:
+            case SQL_HANDLE_DBC:
+            case SQL_HANDLE_STMT:
+            {
+                Diagnosable *diag = reinterpret_cast<Diagnosable*>(handle);
 
-    *msgLen = static_cast<SQLSMALLINT>(outResLen);
+                records = &diag->GetDiagnosticRecords();
 
-    return SQL_SUCCESS;
-}
+                break;
+            }
 
-SQLRETURN SQL_API SQLGetTypeInfo(SQLHSTMT       stmt,
-                                 SQLSMALLINT    type)
-{
-    using ignite::odbc::Statement;
+            default:
+                break;
+        }
 
-    LOG_MSG("SQLGetTypeInfo called\n");
+        if (!records || recNum < 1 || recNum > records->GetStatusRecordsNumber())
+            return SQL_NO_DATA;
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        const DiagnosticRecord& record = records->GetStatusRecord(recNum);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        if (sqlState)
+            CopyStringToBuffer(record.GetSqlState(), reinterpret_cast<char*>(sqlState), 6);
 
-    statement->ExecuteGetTypeInfoQuery(static_cast<int16_t>(type));
+        if (nativeError)
+            *nativeError = 0;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        SqlLen outResLen;
+        ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuffer, msgBufferLen, &outResLen);
 
-SQLRETURN SQL_API SQLEndTran(SQLSMALLINT    handleType,
-                             SQLHANDLE      handle,
-                             SQLSMALLINT    completionType)
-{
-    using namespace ignite::odbc;
+        outBuffer.PutString(record.GetMessage());
 
-    LOG_MSG("SQLEndTran called\n");
+        *msgLen = static_cast<SQLSMALLINT>(outResLen);
 
-    SQLRETURN result;
+        return SQL_SUCCESS;
+    }
 
-    switch (handleType)
+    SQLRETURN SQLGetTypeInfo(SQLHSTMT stmt, SQLSMALLINT type)
     {
-        case SQL_HANDLE_ENV:
-        {
-            Environment *env = reinterpret_cast<Environment*>(handle);
-
-            if (!env)
-                return SQL_INVALID_HANDLE;
-
-            if (completionType == SQL_COMMIT)
-                env->TransactionCommit();
-            else
-                env->TransactionRollback();
-
-            result = env->GetDiagnosticRecords().GetReturnCode();
-
-            break;
-        }
-
-        case SQL_HANDLE_DBC:
-        {
-            Connection *conn = reinterpret_cast<Connection*>(handle);
+        using ignite::odbc::Statement;
 
-            if (!conn)
-                return SQL_INVALID_HANDLE;
+        LOG_MSG("SQLGetTypeInfo called\n");
 
-            if (completionType == SQL_COMMIT)
-                conn->TransactionCommit();
-            else
-                conn->TransactionRollback();
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-            result = conn->GetDiagnosticRecords().GetReturnCode();
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-            break;
-        }
-
-        default:
-        {
-            result = SQL_INVALID_HANDLE;
+        statement->ExecuteGetTypeInfoQuery(static_cast<int16_t>(type));
 
-            break;
-        }
+        return statement->GetDiagnosticRecords().GetReturnCode();
     }
 
-    return result;
-}
-
-SQLRETURN SQL_API SQLGetData(SQLHSTMT       stmt,
-                             SQLUSMALLINT   colNum,
-                             SQLSMALLINT    targetType,
-                             SQLPOINTER     targetValue,
-                             SQLLEN         bufferLength,
-                             SQLLEN*        strLengthOrIndicator)
-{
-    using namespace ignite::odbc::type_traits;
+    SQLRETURN SQLEndTran(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT completionType)
+    {
+        using namespace ignite::odbc;
 
-    using ignite::odbc::Statement;
-    using ignite::odbc::app::ApplicationDataBuffer;
+        LOG_MSG("SQLEndTran called\n");
 
-    LOG_MSG("SQLGetData called\n");
+        SQLRETURN result;
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        switch (handleType)
+        {
+            case SQL_HANDLE_ENV:
+            {
+                Environment *env = reinterpret_cast<Environment*>(handle);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+                if (!env)
+                    return SQL_INVALID_HANDLE;
 
-    IgniteSqlType driverType = ToDriverType(targetType);
+                if (completionType == SQL_COMMIT)
+                    env->TransactionCommit();
+                else
+                    env->TransactionRollback();
 
-    ApplicationDataBuffer dataBuffer(driverType, targetValue, bufferLength, strLengthOrIndicator);
+                result = env->GetDiagnosticRecords().GetReturnCode();
 
-    statement->GetColumnData(colNum, dataBuffer);
+                break;
+            }
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+            case SQL_HANDLE_DBC:
+            {
+                Connection *conn = reinterpret_cast<Connection*>(handle);
 
-SQLRETURN SQL_API SQLSetEnvAttr(SQLHENV     env,
-                                SQLINTEGER  attr,
-                                SQLPOINTER  value,
-                                SQLINTEGER  valueLen)
-{
-    using ignite::odbc::Environment;
+                if (!conn)
+                    return SQL_INVALID_HANDLE;
 
-    LOG_MSG("SQLSetEnvAttr called\n");
+                if (completionType == SQL_COMMIT)
+                    conn->TransactionCommit();
+                else
+                    conn->TransactionRollback();
 
-    Environment *environment = reinterpret_cast<Environment*>(env);
+                result = conn->GetDiagnosticRecords().GetReturnCode();
 
-    if (!environment)
-        return SQL_INVALID_HANDLE;
+                break;
+            }
 
-    environment->SetAttribute(attr, value, valueLen);
+            default:
+            {
+                result = SQL_INVALID_HANDLE;
 
-    return environment->GetDiagnosticRecords().GetReturnCode();
-}
+                break;
+            }
+        }
 
-SQLRETURN SQL_API SQLGetEnvAttr(SQLHENV     env,
-                                SQLINTEGER  attr,
-                                SQLPOINTER  valueBuf,
-                                SQLINTEGER  valueBufLen,
-                                SQLINTEGER* valueResLen)
-{
-    using namespace ignite::odbc;
-    using namespace ignite::odbc::type_traits;
+        return result;
+    }
 
-    using ignite::odbc::app::ApplicationDataBuffer;
+    SQLRETURN SQLGetData(SQLHSTMT       stmt,
+                         SQLUSMALLINT   colNum,
+                         SQLSMALLINT    targetType,
+                         SQLPOINTER     targetValue,
+                         SQLLEN         bufferLength,
+                         SQLLEN*        strLengthOrIndicator)
+    {
+        using namespace ignite::odbc::type_traits;
 
-    LOG_MSG("SQLGetEnvAttr called\n");
+        using ignite::odbc::Statement;
+        using ignite::odbc::app::ApplicationDataBuffer;
 
-    Environment *environment = reinterpret_cast<Environment*>(env);
+        LOG_MSG("SQLGetData called\n");
 
-    if (!environment)
-        return SQL_INVALID_HANDLE;
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    SqlLen outResLen;
-    ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, valueBuf,
-        static_cast<int32_t>(valueBufLen), &outResLen);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    environment->GetAttribute(attr, outBuffer);
+        IgniteSqlType driverType = ToDriverType(targetType);
 
-    *valueResLen = static_cast<SQLSMALLINT>(outResLen);
+        ApplicationDataBuffer dataBuffer(driverType, targetValue, bufferLength, strLengthOrIndicator);
 
-    return environment->GetDiagnosticRecords().GetReturnCode();
-}
+        statement->GetColumnData(colNum, dataBuffer);
 
-SQLRETURN SQL_API SQLSpecialColumns(SQLHSTMT    stmt,
-                                    SQLSMALLINT idType,
-                                    SQLCHAR*    catalogName,
-                                    SQLSMALLINT catalogNameLen,
-                                    SQLCHAR*    schemaName,
-                                    SQLSMALLINT schemaNameLen,
-                                    SQLCHAR*    tableName,
-                                    SQLSMALLINT tableNameLen,
-                                    SQLSMALLINT scope,
-                                    SQLSMALLINT nullable)
-{
-    using namespace ignite::odbc;
+        return statement->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    using ignite::utility::SqlStringToString;
+    SQLRETURN SQLSetEnvAttr(SQLHENV     env,
+                            SQLINTEGER  attr,
+                            SQLPOINTER  value,
+                            SQLINTEGER  valueLen)
+    {
+        using ignite::odbc::Environment;
 
-    LOG_MSG("SQLSpecialColumns called\n");
+        LOG_MSG("SQLSetEnvAttr called\n");
 
-    Statement *statement = reinterpret_cast<Statement*>(stmt);
+        Environment *environment = reinterpret_cast<Environment*>(env);
 
-    if (!statement)
-        return SQL_INVALID_HANDLE;
+        if (!environment)
+            return SQL_INVALID_HANDLE;
 
-    std::string catalog = SqlStringToString(catalogName, catalogNameLen);
-    std::string schema = SqlStringToString(schemaName, schemaNameLen);
-    std::string table = SqlStringToString(tableName, tableNameLen);
+        environment->SetAttribute(attr, value, valueLen);
 
-    LOG_MSG("catalog: %s\n", catalog.c_str());
-    LOG_MSG("schema: %s\n", schema.c_str());
-    LOG_MSG("table: %s\n", table.c_str());
+        return environment->GetDiagnosticRecords().GetReturnCode();
+    }
 
-    statement->ExecuteSpecialColumnsQuery(idType, catalog, schema, table, scope, nullable);
+    SQLRETURN SQLGetEnvAttr(SQLHENV     env,
+                            SQLINTEGER  attr,
+                            SQLPOINTER  valueBuf,
+                            SQLINTEGER  valueBufLen,
+                            SQLINTEGER* valueResLen)
+    {
+        using namespace ignite::odbc;
+        using namespace ignite::odbc::type_traits;
 
-    return statement->GetDiagnosticRecords().GetReturnCode();
-}
+        using ignite::odbc::app::ApplicationDataBuffer;
 
-//
-// ==== Not implemented ====
-//
+        LOG_MSG("SQLGetEnvAttr called\n");
 
-SQLRETURN SQL_API SQLCancel(SQLHSTMT stmt)
-{
-    LOG_MSG("SQLCancel called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLColAttributes(SQLHSTMT     stmt,
-                                   SQLUSMALLINT colNum,
-                                   SQLUSMALLINT fieldId,
-                                   SQLPOINTER   strAttrBuf,
-                                   SQLSMALLINT  strAttrBufLen,
-                                   SQLSMALLINT* strAttrResLen,
-                                   SQLLEN*      numAttrBuf)
-{
-    LOG_MSG("SQLColAttributes called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLError(SQLHENV      env,
-                           SQLHDBC      conn,
-                           SQLHSTMT     stmt,
-                           SQLCHAR*     state,
-                           SQLINTEGER*  error,
-                           SQLCHAR*     msgBuf,
-                           SQLSMALLINT  msgBufLen,
-                           SQLSMALLINT* msgResLen)
-{
-    LOG_MSG("SQLError called\n");
-    return(SQL_NO_DATA_FOUND);
-}
-
-SQLRETURN SQL_API SQLGetCursorName(SQLHSTMT     stmt,
-                                   SQLCHAR*     nameBuf,
-                                   SQLSMALLINT  nameBufLen,
-                                   SQLSMALLINT* nameResLen)
-{
-    LOG_MSG("SQLGetCursorName called\n");
-    return SQL_SUCCESS;
-}
+        Environment *environment = reinterpret_cast<Environment*>(env);
 
-SQLRETURN SQL_API SQLSetCursorName(SQLHSTMT     stmt,
-                                   SQLCHAR*     name,
-                                   SQLSMALLINT  nameLen)
-{
-    LOG_MSG("SQLSetCursorName called\n");
-    return SQL_SUCCESS;
-}
+        if (!environment)
+            return SQL_INVALID_HANDLE;
 
-SQLRETURN SQL_API SQLGetConnectOption(SQLHDBC       conn,
-                                      SQLUSMALLINT  option,
-                                      SQLPOINTER    value)
-{
-    LOG_MSG("SQLGetConnectOption called\n");
-    return SQL_SUCCESS;
-}
+        SqlLen outResLen;
+        ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, valueBuf,
+            static_cast<int32_t>(valueBufLen), &outResLen);
 
-SQLRETURN SQL_API SQLGetFunctions(SQLHDBC       conn,
-                                  SQLUSMALLINT  funcId,
-                                  SQLUSMALLINT* supported)
-{
-    LOG_MSG("SQLGetFunctions called\n");
-    return SQL_SUCCESS;
-}
+        environment->GetAttribute(attr, outBuffer);
 
-SQLRETURN SQL_API SQLGetStmtOption(SQLHSTMT     stmt,
-                                   SQLUSMALLINT option,
-                                   SQLPOINTER   value)
-{
-    LOG_MSG("SQLGetStmtOption called\n");
-    return SQL_SUCCESS;
-}
+        if (valueResLen)
+            *valueResLen = static_cast<SQLSMALLINT>(outResLen);
 
-SQLRETURN SQL_API SQLParamData(SQLHSTMT    stmt,
-                               SQLPOINTER* value)
-{
-    LOG_MSG("SQLParamData called\n");
-    return SQL_SUCCESS;
-}
+        return environment->GetDiagnosticRecords().GetReturnCode();
+    }
 
-SQLRETURN SQL_API SQLPutData(SQLHSTMT     stmt,
-                             SQLPOINTER   data,
-                             SQLLEN       strLengthOrIndicator)
-{
-    LOG_MSG("SQLPutData called\n");
-    return SQL_SUCCESS;
-}
+    SQLRETURN SQLSpecialColumns(SQLHSTMT    stmt,
+                                SQLSMALLINT idType,
+                                SQLCHAR*    catalogName,
+                                SQLSMALLINT catalogNameLen,
+                                SQLCHAR*    schemaName,
+                                SQLSMALLINT schemaNameLen,
+                                SQLCHAR*    tableName,
+                                SQLSMALLINT tableNameLen,
+                                SQLSMALLINT scope,
+                                SQLSMALLINT nullable)
+    {
+        using namespace ignite::odbc;
 
-SQLRETURN SQL_API SQLSetConnectOption(SQLHDBC       conn,
-                                      SQLUSMALLINT  option,
-                                      SQLULEN       value)
-{
-    LOG_MSG("SQLSetConnectOption called\n");
-    return SQL_SUCCESS;
-}
+        using ignite::utility::SqlStringToString;
 
-SQLRETURN SQL_API SQLSetStmtOption(SQLHSTMT     stmt,
-                                   SQLUSMALLINT option,
-                                   SQLULEN      value)
-{
-    LOG_MSG("SQLSetStmtOption called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLStatistics(SQLHSTMT        stmt,
-                                SQLCHAR*        catalogName,
-                                SQLSMALLINT     catalogNameLen,
-                                SQLCHAR*        schemaName,
-                                SQLSMALLINT     schemaNameLen,
-                                SQLCHAR*        tableName,
-                                SQLSMALLINT     tableNameLen,
-                                SQLUSMALLINT    unique,
-                                SQLUSMALLINT    reserved)
-{
-    LOG_MSG("SQLStatistics called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLBrowseConnect(SQLHDBC      conn,
-                                   SQLCHAR*     inConnectionStr,
-                                   SQLSMALLINT  inConnectionStrLen,
-                                   SQLCHAR*     outConnectionStrBuf,
-                                   SQLSMALLINT  outConnectionStrBufLen,
-                                   SQLSMALLINT* outConnectionStrResLen)
-{
-    LOG_MSG("SQLBrowseConnect called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLProcedureColumns(SQLHSTMT      stmt,
-                                      SQLCHAR *     catalogName,
-                                      SQLSMALLINT   catalogNameLen,
-                                      SQLCHAR *     schemaName,
-                                      SQLSMALLINT   schemaNameLen,
-                                      SQLCHAR *     procName,
-                                      SQLSMALLINT   procNameLen,
-                                      SQLCHAR *     columnName,
-                                      SQLSMALLINT   columnNameLen)
-{
-    LOG_MSG("SQLProcedureColumns called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLSetPos(SQLHSTMT        stmt,
-                            SQLSETPOSIROW   rowNum,
-                            SQLUSMALLINT    operation,
-                            SQLUSMALLINT    lockType)
-{
-    LOG_MSG("SQLSetPos called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLSetScrollOptions(SQLHSTMT      stmt,
-                                      SQLUSMALLINT  concurrency,
-                                      SQLLEN        crowKeyset,
-                                      SQLUSMALLINT  crowRowset)
-{
-    LOG_MSG("SQLSetScrollOptions called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC     conn,
-                                    SQLINTEGER  attr,
-                                    SQLPOINTER  valueBuf,
-                                    SQLINTEGER  valueBufLen,
-                                    SQLINTEGER* valueResLen)
-{
-    LOG_MSG("SQLGetConnectAttr called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC     conn,
-                                    SQLINTEGER  attr,
-                                    SQLPOINTER  value,
-                                    SQLINTEGER  valueLen)
-{
-    using ignite::odbc::Connection;
+        LOG_MSG("SQLSpecialColumns called\n");
 
-    LOG_MSG("SQLSetConnectAttr called\n");
+        Statement *statement = reinterpret_cast<Statement*>(stmt);
 
-    Connection *connection = reinterpret_cast<Connection*>(conn);
+        if (!statement)
+            return SQL_INVALID_HANDLE;
 
-    if (!connection)
-        return SQL_INVALID_HANDLE;
+        std::string catalog = SqlStringToString(catalogName, catalogNameLen);
+        std::string schema = SqlStringToString(schemaName, schemaNameLen);
+        std::string table = SqlStringToString(tableName, tableNameLen);
 
-    return SQL_SUCCESS;
-}
+        LOG_MSG("catalog: %s\n", catalog.c_str());
+        LOG_MSG("schema: %s\n", schema.c_str());
+        LOG_MSG("table: %s\n", table.c_str());
 
-SQLRETURN SQL_API SQLBulkOperations(SQLHSTMT       stmt,
-                                    SQLUSMALLINT   operation)
-{
-    LOG_MSG("SQLBulkOperations called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLTablePrivileges(SQLHSTMT      stmt,
-                                     SQLCHAR*      catalogName,
-                                     SQLSMALLINT   catalogNameLen,
-                                     SQLCHAR*      schemaName,
-                                     SQLSMALLINT   schemaNameLen,
-                                     SQLCHAR*      tableName,
-                                     SQLSMALLINT   tableNameLen)
-{
-    LOG_MSG("SQLTablePrivileges called\n");
-    return SQL_SUCCESS;
-}
+        statement->ExecuteSpecialColumnsQuery(idType, catalog, schema, table, scope, nullable);
 
-SQLRETURN SQL_API SQLCopyDesc(SQLHDESC src, SQLHDESC dst)
-{
-    LOG_MSG("SQLCopyDesc called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLGetDescField(SQLHDESC      descr,
-                                  SQLSMALLINT   recNum,
-                                  SQLSMALLINT   fieldId,
-                                  SQLPOINTER    buffer,
-                                  SQLINTEGER    bufferLen,
-                                  SQLINTEGER*   resLen)
-{
-    LOG_MSG("SQLGetDescField called\n");
-    return SQL_SUCCESS;
-}
-
-SQLRETURN SQL_API SQLGetDescRec(SQLHDESC        DescriptorHandle,
-                                SQLSMALLINT     RecNumber,
-                                SQLCHAR*        nameBuffer,
-                 

<TRUNCATED>

Mime
View raw message