Repository: ignite
Updated Branches:
  refs/heads/master 798fc9f7f -> e28f68ec4


http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/column.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/column.cpp 
b/modules/platforms/cpp/odbc/src/column.cpp
index bd2abda..5776743 100644
--- a/modules/platforms/cpp/odbc/src/column.cpp
+++ b/modules/platforms/cpp/odbc/src/column.cpp
@@ -325,32 +325,34 @@ namespace ignite
             size = sizeTmp;
         }
 
-        SqlResult::Type Column::ReadToBuffer(BinaryReaderImpl& reader, 
app::ApplicationDataBuffer& dataBuf)
+        app::ConversionResult::Type Column::ReadToBuffer(BinaryReaderImpl& 
reader, app::ApplicationDataBuffer& dataBuf)
         {
             if (!IsValid())
-                return SqlResult::AI_ERROR;
+                return app::ConversionResult::AI_FAILURE;
 
             if (GetUnreadDataLength() == 0)
             {
                 dataBuf.PutNull();
 
-                return SqlResult::AI_NO_DATA;
+                return app::ConversionResult::AI_NO_DATA;
             }
 
             InteropInputStream* stream = reader.GetStream();
 
             if (!stream)
-                return SqlResult::AI_ERROR;
+                return app::ConversionResult::AI_FAILURE;
 
             InteropStreamPositionGuard<InteropInputStream> guard(*stream);
 
             stream->Position(startPos);
 
+            app::ConversionResult::Type convRes = 
app::ConversionResult::AI_SUCCESS;
+
             switch (type)
             {
                 case IGNITE_TYPE_BYTE:
                 {
-                    dataBuf.PutInt8(reader.ReadInt8());
+                    convRes = dataBuf.PutInt8(reader.ReadInt8());
 
                     IncreaseOffset(size);
 
@@ -360,7 +362,7 @@ namespace ignite
                 case IGNITE_TYPE_SHORT:
                 case IGNITE_TYPE_CHAR:
                 {
-                    dataBuf.PutInt16(reader.ReadInt16());
+                    convRes = dataBuf.PutInt16(reader.ReadInt16());
 
                     IncreaseOffset(size);
 
@@ -369,7 +371,7 @@ namespace ignite
 
                 case IGNITE_TYPE_INT:
                 {
-                    dataBuf.PutInt32(reader.ReadInt32());
+                    convRes = dataBuf.PutInt32(reader.ReadInt32());
 
                     IncreaseOffset(size);
 
@@ -378,7 +380,7 @@ namespace ignite
 
                 case IGNITE_TYPE_LONG:
                 {
-                    dataBuf.PutInt64(reader.ReadInt64());
+                    convRes = dataBuf.PutInt64(reader.ReadInt64());
 
                     IncreaseOffset(size);
 
@@ -387,7 +389,7 @@ namespace ignite
 
                 case IGNITE_TYPE_FLOAT:
                 {
-                    dataBuf.PutFloat(reader.ReadFloat());
+                    convRes = dataBuf.PutFloat(reader.ReadFloat());
 
                     IncreaseOffset(size);
 
@@ -396,7 +398,7 @@ namespace ignite
 
                 case IGNITE_TYPE_DOUBLE:
                 {
-                    dataBuf.PutDouble(reader.ReadDouble());
+                    convRes = dataBuf.PutDouble(reader.ReadDouble());
 
                     IncreaseOffset(size);
 
@@ -405,7 +407,7 @@ namespace ignite
 
                 case IGNITE_TYPE_BOOL:
                 {
-                    dataBuf.PutInt8(reader.ReadBool() ? 1 : 0);
+                    convRes = dataBuf.PutInt8(reader.ReadBool() ? 1 : 0);
 
                     IncreaseOffset(size);
 
@@ -417,7 +419,8 @@ namespace ignite
                     std::string str;
                     utility::ReadString(reader, str);
 
-                    int32_t written = dataBuf.PutString(str.substr(offset));
+                    int32_t written = 0;
+                    convRes = dataBuf.PutString(str.substr(offset), written);
 
                     IncreaseOffset(written);
 
@@ -428,7 +431,7 @@ namespace ignite
                 {
                     Guid guid = reader.ReadGuid();
 
-                    dataBuf.PutGuid(guid);
+                    convRes = dataBuf.PutGuid(guid);
 
                     IncreaseOffset(size);
 
@@ -437,7 +440,7 @@ namespace ignite
 
                 case IGNITE_HDR_NULL:
                 {
-                    dataBuf.PutNull();
+                    convRes = dataBuf.PutNull();
 
                     IncreaseOffset(size);
 
@@ -450,13 +453,15 @@ namespace ignite
                     int32_t len;
 
                     if (!GetObjectLength(*stream, len))
-                        return SqlResult::AI_ERROR;
+                        return app::ConversionResult::AI_FAILURE;
 
                     std::vector<int8_t> data(len);
 
                     stream->ReadInt8Array(&data[0], 
static_cast<int32_t>(data.size()));
 
-                    int32_t written = dataBuf.PutBinaryData(data.data() + 
offset, static_cast<size_t>(len - offset));
+                    int32_t written = 0;
+                    convRes = dataBuf.PutBinaryData(data.data() + offset,
+                        static_cast<size_t>(len - offset), written);
 
                     IncreaseOffset(written);
 
@@ -469,7 +474,7 @@ namespace ignite
 
                     utility::ReadDecimal(reader, res);
 
-                    dataBuf.PutDecimal(res);
+                    convRes = dataBuf.PutDecimal(res);
 
                     IncreaseOffset(size);
 
@@ -480,7 +485,7 @@ namespace ignite
                 {
                     Date date = reader.ReadDate();
 
-                    dataBuf.PutDate(date);
+                    convRes = dataBuf.PutDate(date);
 
                     break;
                 }
@@ -489,7 +494,7 @@ namespace ignite
                 {
                     Timestamp ts = reader.ReadTimestamp();
 
-                    dataBuf.PutTimestamp(ts);
+                    convRes = dataBuf.PutTimestamp(ts);
 
                     break;
                 }
@@ -498,7 +503,7 @@ namespace ignite
                 {
                     Time time = reader.ReadTime();
 
-                    dataBuf.PutTime(time);
+                    convRes = dataBuf.PutTime(time);
 
                     break;
                 }
@@ -511,20 +516,18 @@ namespace ignite
 
                     stream->ReadInt8Array(&data[0], 
static_cast<int32_t>(data.size()));
 
-                    int32_t written = dataBuf.PutBinaryData(data.data(), 
data.size());
+                    int32_t written = 0;
+                    convRes = dataBuf.PutBinaryData(data.data(), data.size(), 
written);
 
                     IncreaseOffset(written);
                     break;
                 }
 
                 default:
-                {
-                    // This is a fail case. Return false.
-                    return SqlResult::AI_ERROR;
-                }
+                    return app::ConversionResult::AI_UNSUPPORTED_CONVERSION;
             }
 
-            return SqlResult::AI_SUCCESS;
+            return convRes;
         }
 
         void Column::IncreaseOffset(int32_t value)

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp 
b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index a70121d..7279ea6 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -546,6 +546,30 @@ namespace ignite
 #ifdef SQL_ALTER_TABLE
                     DBG_STR_CASE(SQL_ALTER_TABLE);
 #endif // SQL_ALTER_TABLE
+#ifdef SQL_FETCH_DIRECTION
+                    DBG_STR_CASE(SQL_FETCH_DIRECTION);
+#endif // SQL_FETCH_DIRECTION
+#ifdef SQL_LOCK_TYPES
+                    DBG_STR_CASE(SQL_LOCK_TYPES);
+#endif // SQL_LOCK_TYPES
+#ifdef SQL_ODBC_API_CONFORMANCE
+                    DBG_STR_CASE(SQL_ODBC_API_CONFORMANCE);
+#endif // SQL_ODBC_API_CONFORMANCE
+#ifdef SQL_ODBC_SQL_CONFORMANCE
+                    DBG_STR_CASE(SQL_ODBC_SQL_CONFORMANCE);
+#endif // SQL_ODBC_SQL_CONFORMANCE
+#ifdef SQL_POSITIONED_STATEMENTS
+                    DBG_STR_CASE(SQL_POSITIONED_STATEMENTS);
+#endif // SQL_POSITIONED_STATEMENTS
+#ifdef SQL_SCROLL_CONCURRENCY
+                    DBG_STR_CASE(SQL_SCROLL_CONCURRENCY);
+#endif // SQL_SCROLL_CONCURRENCY
+#ifdef SQL_STATIC_SENSITIVITY
+                    DBG_STR_CASE(SQL_STATIC_SENSITIVITY);
+#endif // SQL_STATIC_SENSITIVITY
+#ifdef SQL_DTC_TRANSITION_COST
+                    DBG_STR_CASE(SQL_DTC_TRANSITION_COST);
+#endif // SQL_DTC_TRANSITION_COST
                     default:
                         break;
                 }
@@ -890,6 +914,18 @@ namespace ignite
 
 #ifdef SQL_GETDATA_EXTENSIONS
                 // Bitmask enumerating extensions to SQLGetData.
+                // SQL_GD_ANY_COLUMN = SQLGetData can be called for any 
unbound column, including those before the last
+                //     bound column. Note that the columns must be called in 
order of ascending column number unless
+                //     SQL_GD_ANY_ORDER is also returned.
+                // SQL_GD_ANY_ORDER = SQLGetData can be called for unbound 
columns in any order. Note that SQLGetData
+                //     can be called only for columns after the last bound 
column unless SQL_GD_ANY_COLUMN is also
+                //     returned.
+                // SQL_GD_BLOCK = SQLGetData can be called for an unbound 
column in any row in a block (where the rowset
+                //     size is greater than 1) of data after positioning to 
that row with SQLSetPos.
+                // SQL_GD_BOUND = SQLGetData can be called for bound columns 
in addition to unbound columns. A driver
+                //     cannot return this value unless it also returns 
SQL_GD_ANY_COLUMN.
+                // SQL_GD_OUTPUT_PARAMS = SQLGetData can be called to return 
output parameter values. For more
+                //     information, see Retrieving Output.
                 intParams[SQL_GETDATA_EXTENSIONS] = SQL_GD_ANY_COLUMN | 
SQL_GD_ANY_ORDER | SQL_GD_BOUND;
 #endif // SQL_GETDATA_EXTENSIONS
 
@@ -1004,7 +1040,14 @@ namespace ignite
 #endif // SQL_OJ_CAPABILITIES
 
 #ifdef SQL_POS_OPERATIONS
-                // Bitmask enumerating the support operations in SQLSetPos.
+                // DEPRECATED. Included for backward-compatibility.
+                // A bitmask enumerating the supported operations in SQLSetPos.
+                //
+                // SQL_POS_POSITION (ODBC 2.0)
+                // SQL_POS_REFRESH (ODBC 2.0)
+                // SQL_POS_UPDATE (ODBC 2.0)
+                // SQL_POS_DELETE (ODBC 2.0)
+                // SQL_POS_ADD (ODBC 2.0)
                 intParams[SQL_POS_OPERATIONS] = 0;
 #endif // SQL_POS_OPERATIONS
 
@@ -2139,6 +2182,94 @@ namespace ignite
                 intParams[SQL_UNION] = SQL_U_UNION | SQL_U_UNION_ALL;
 #endif // SQL_UNION
 
+#ifdef SQL_FETCH_DIRECTION
+                // DEPRECATED. Included for backward-compatibility.
+                // The information type was introduced in ODBC 1.0; each 
bitmask is labeled with the version in which
+                // it was introduced.
+                // A bitmask enumerating the supported fetch direction options:
+                // SQL_FD_FETCH_NEXT (ODBC 1.0)
+                // SQL_FD_FETCH_FIRST (ODBC 1.0)
+                // SQL_FD_FETCH_LAST (ODBC 1.0)
+                // SQL_FD_FETCH_PRIOR (ODBC 1.0)
+                // SQL_FD_FETCH_ABSOLUTE (ODBC 1.0)
+                // SQL_FD_FETCH_RELATIVE (ODBC 1.0)
+                // SQL_FD_FETCH_BOOKMARK (ODBC 2.0)
+                intParams[SQL_FETCH_DIRECTION] = SQL_FD_FETCH_NEXT | 
SQL_FD_FETCH_PRIOR;
+#endif // SQL_FETCH_DIRECTION
+
+#ifdef SQL_LOCK_TYPES
+                // DEPRECATED. Included for backward-compatibility.
+                // A bitmask enumerating the supported lock types for the 
fLock argument in SQLSetPos:
+                // SQL_LCK_NO_CHANGE
+                // SQL_LCK_EXCLUSIVE
+                // SQL_LCK_UNLOCK
+                intParams[SQL_LOCK_TYPES] = SQL_LCK_NO_CHANGE;
+#endif // SQL_LOCK_TYPES
+
+#ifdef SQL_ODBC_API_CONFORMANCE
+                // DEPRECATED. Included for backward-compatibility.
+                // A value indicating the level of ODBC conformance.
+                // SQL_OAC_NONE = None
+                // SQL_OAC_LEVEL1 = Level 1 supported
+                // SQL_OAC_LEVEL2 = Level 2 supported
+                intParams[SQL_ODBC_API_CONFORMANCE] = SQL_OAC_LEVEL1;
+#endif // SQL_ODBC_API_CONFORMANCE
+
+#ifdef SQL_ODBC_SQL_CONFORMANCE
+                // DEPRECATED. Included for backward-compatibility.
+                // A value indicating SQL grammar supported by the driver.
+                // See the following link for a definition of SQL conformance 
levels:
+                // 
https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/appendix-c-sql-grammar
+                //
+                // SQL_OSC_MINIMUM = Minimum grammar supported
+                // SQL_OSC_CORE = Core grammar supported
+                // SQL_OSC_EXTENDED = Extended grammar supported
+                intParams[SQL_ODBC_SQL_CONFORMANCE] = SQL_OSC_CORE;
+#endif // SQL_ODBC_SQL_CONFORMANCE
+
+#ifdef SQL_POSITIONED_STATEMENTS
+                // DEPRECATED. Included for backward-compatibility.
+                // A bitmask enumerating the supported positioned SQL 
statements.
+                // The following bitmasks are used to determine which options 
are supported:
+                // SQL_PS_POSITIONED_DELETE
+                // SQL_PS_POSITIONED_UPDATE
+                // SQL_PS_SELECT_FOR_UPDATE
+                intParams[SQL_POSITIONED_STATEMENTS] = 
SQL_PS_SELECT_FOR_UPDATE;
+#endif // SQL_POSITIONED_STATEMENTS
+
+#ifdef SQL_SCROLL_CONCURRENCY
+                // DEPRECATED. Included for backward-compatibility.
+                // A bitmask enumerating the concurrency control options 
supported for the cursor.
+                // The following bitmasks are used to determine which options 
are supported:
+                // SQL_SCCO_READ_ONLY = Cursor is read-only. No updates are 
allowed.
+                // SQL_SCCO_LOCK = Cursor uses the lowest level of locking 
sufficient to ensure that the row can be
+                //    updated.
+                // SQL_SCCO_OPT_ROWVER = Cursor uses optimistic concurrency 
control, comparing row versions, such as
+                //    SQLBase ROWID or Sybase TIMESTAMP.
+                // SQL_SCCO_OPT_VALUES = Cursor uses optimistic concurrency 
control, comparing values.
+                intParams[SQL_SCROLL_CONCURRENCY] = SQL_SCCO_READ_ONLY;
+#endif // SQL_SCROLL_CONCURRENCY
+
+#ifdef SQL_STATIC_SENSITIVITY
+                // DEPRECATED. Included for backward-compatibility.
+                // A bitmask enumerating whether changes made by an 
application to a static or keyset-driven cursor
+                // through SQLSetPos or positioned update or delete statements 
can be detected by that application.
+                //
+                // Whether an application can detect changes made to the 
result set by other users, including other
+                // cursors in the same application, depends on the cursor type.
+                //
+                // SQL_SS_ADDITIONS = Added rows are visible to the cursor; 
the cursor can scroll to these rows.
+                //    Where these rows are added to the cursor is 
driver-dependent.
+                // SQL_SS_DELETIONS = Deleted rows are no longer available to 
the cursor and do not leave a "hole" in
+                //   the result set; after the cursor scrolls from a deleted 
row, it cannot return to that row.
+                // SQL_SS_UPDATES = Updates to rows are visible to the cursor; 
if the cursor scrolls from and returns to
+                //    an updated row, the data returned by the cursor is the 
updated data, not the original data. This
+                //    option applies only to static cursors or updates on 
keyset - driven cursors that do not update the
+                //    key. This option does not apply for a dynamic cursor or 
in the case in which a key is changed in a
+                //    mixed cursor.
+                intParams[SQL_STATIC_SENSITIVITY] = 0;
+#endif // SQL_STATIC_SENSITIVITY
+
                 //
                 //======================= Short Params ========================
                 //
@@ -2146,7 +2277,7 @@ namespace ignite
 #ifdef SQL_MAX_CONCURRENT_ACTIVITIES
                 // The maximum number of active statements that the driver can 
 support for a connection. Zero mean no
                 // limit.
-                shortParams[SQL_MAX_CONCURRENT_ACTIVITIES] = 32;
+                shortParams[SQL_MAX_CONCURRENT_ACTIVITIES] = 0;
 #endif // SQL_MAX_CONCURRENT_ACTIVITIES
 
 #ifdef SQL_CURSOR_COMMIT_BEHAVIOR
@@ -2341,7 +2472,7 @@ namespace ignite
                 // names.
                 // An FIPS Entry level-conformant driver will return at least 
18. An FIPS Intermediate level-conformant
                 // driver will return at least 128.
-                shortParams[SQL_MAX_IDENTIFIER_LEN] = 128;
+                shortParams[SQL_MAX_IDENTIFIER_LEN] = 0;
 #endif // SQL_MAX_IDENTIFIER_LEN
 
 #ifdef SQL_MAX_PROCEDURE_NAME_LEN

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp 
b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
index 096593f..143d949 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
@@ -29,6 +29,8 @@ namespace ignite
             void DiagnosableAdapter::AddStatusRecord(SqlState::Type  sqlState,
                 const std::string& message, int32_t rowNum, int32_t columnNum)
             {
+                LOG_MSG("Adding new record: " << message << ", rowNum: " << 
rowNum << ", columnNum: " << columnNum);
+
                 if (connection)
                 {
                     diagnosticRecords.AddStatusRecord(
@@ -43,15 +45,11 @@ namespace ignite
 
             void DiagnosableAdapter::AddStatusRecord(SqlState::Type  sqlState, 
const std::string& message)
             {
-                LOG_MSG("Adding new record: " << message);
-
                 AddStatusRecord(sqlState, message, 0, 0);
             }
 
             void DiagnosableAdapter::AddStatusRecord(const OdbcError& err)
             {
-                LOG_MSG("Adding new record: " << err.GetErrorMessage());
-
                 AddStatusRecord(err.GetStatus(), err.GetErrorMessage(), 0, 0);
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp 
b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
index 7fa7669..7b82b40 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
@@ -43,6 +43,9 @@ namespace
     /** SQL state 01S02 constant. */
     const std::string STATE_01S02 = "01S02";
 
+    /** SQL state 01S07 constant. */
+    const std::string STATE_01S07 = "01S07";
+
     /** SQL state 07009 constant. */
     const std::string STATE_07009 = "07009";
 
@@ -64,6 +67,9 @@ namespace
     /** SQL state 08S01 constant. */
     const std::string STATE_08S01 = "08S01";
 
+    /** SQL state 22002 constant. */
+    const std::string STATE_22002 = "22002";
+
     /** SQL state 22026 constant. */
     const std::string STATE_22026 = "22026";
 
@@ -281,9 +287,15 @@ namespace ignite
                     case SqlState::S01S02_OPTION_VALUE_CHANGED:
                         return STATE_01S02;
 
+                    case SqlState::S01S07_FRACTIONAL_TRUNCATION:
+                        return STATE_01S07;
+
                     case SqlState::S07006_RESTRICTION_VIOLATION:
                         return STATE_07006;
 
+                    case SqlState::S22002_INDICATOR_NEEDED:
+                        return STATE_22002;
+
                     case SqlState::S22026_DATA_LENGTH_MISMATCH:
                         return STATE_22026;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp 
b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
index f1bd9a1..b7f212a 100644
--- a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
+++ b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
@@ -19,6 +19,7 @@
 #include "ignite/odbc/meta/column_meta.h"
 #include "ignite/odbc/type_traits.h"
 #include "ignite/odbc/common_types.h"
+#include "ignite/odbc/log.h"
 
 namespace ignite
 {
@@ -152,7 +153,7 @@ namespace ignite
                     {
                         value = SQL_FALSE;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_CASE_SENSITIVE:
@@ -162,7 +163,7 @@ namespace ignite
                         else
                             value = SQL_FALSE;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_CONCISE_TYPE:
@@ -170,14 +171,14 @@ namespace ignite
                     {
                         value = type_traits::BinaryToSqlType(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_DISPLAY_SIZE:
                     {
                         value = type_traits::BinaryTypeDisplaySize(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_LENGTH:
@@ -186,21 +187,21 @@ namespace ignite
                     {
                         value = 
type_traits::BinaryTypeTransferLength(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_NULLABLE:
                     {
                         value = type_traits::BinaryTypeNullability(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_NUM_PREC_RADIX:
                     {
                         value = type_traits::BinaryTypeNumPrecRadix(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_PRECISION:
@@ -208,7 +209,7 @@ namespace ignite
                     {
                         value = type_traits::BinaryTypeColumnSize(dataType);
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_SCALE:
@@ -219,42 +220,44 @@ namespace ignite
                         if (value < 0)
                             value = 0;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_SEARCHABLE:
                     {
                         value = SQL_PRED_BASIC;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_UNNAMED:
                     {
                         value = columnName.empty() ? SQL_UNNAMED : SQL_NAMED;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_UNSIGNED:
                     {
                         value = type_traits::BinaryTypeUnsigned(dataType) ? 
SQL_TRUE : SQL_FALSE;
 
-                        return true;
+                        break;
                     }
 
                     case SQL_DESC_UPDATABLE:
                     {
-                        // We do not support update for now so just set all
-                        // columns to readonly.
-                        value = SQL_ATTR_READONLY;
+                        value = SQL_ATTR_READWRITE_UNKNOWN;
 
-                        return true;
+                        break;
                     }
 
                     default:
                         return false;
                 }
+
+                LOG_MSG("value: " << value);
+
+                return true;
             }
 
             void ReadColumnMetaVector(ignite::impl::binary::BinaryReaderImpl& 
reader, ColumnMetaVector& meta)
@@ -273,4 +276,4 @@ namespace ignite
             }
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/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 e4b47b9..dfa2dec 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -753,6 +753,8 @@ namespace ignite
 
         int64_t res = statement->AffectedRows();
 
+        LOG_MSG("Row count: " << res);
+
         if (rowCnt)
             *rowCnt = static_cast<SQLLEN>(res);
 
@@ -813,11 +815,11 @@ namespace ignite
 
         LOG_MSG("SQLGetStmtAttr called");
 
-#ifdef ODBC_DEBUG
+#ifdef _DEBUG
         using odbc::type_traits::StatementAttrIdToString;
 
         LOG_MSG("Attr: " << StatementAttrIdToString(attr) << " (" << attr << 
")");
-#endif //ODBC_DEBUG
+#endif //_DEBUG
 
         Statement *statement = reinterpret_cast<Statement*>(stmt);
 
@@ -836,13 +838,13 @@ namespace ignite
     {
         using odbc::Statement;
 
-        LOG_MSG("SQLSetStmtAttr called");
+        LOG_MSG("SQLSetStmtAttr called: " << attr);
 
-#ifdef ODBC_DEBUG
+#ifdef _DEBUG
         using odbc::type_traits::StatementAttrIdToString;
 
         LOG_MSG("Attr: " << StatementAttrIdToString(attr) << " (" << attr << 
")");
-#endif //ODBC_DEBUG
+#endif //_DEBUG
 
         Statement *statement = reinterpret_cast<Statement*>(stmt);
 
@@ -1357,7 +1359,7 @@ namespace ignite
     {
         using odbc::Connection;
 
-        LOG_MSG("SQLSetConnectAttr called");
+        LOG_MSG("SQLSetConnectAttr called(" << attr << ", " << value << ")");
 
         Connection *connection = reinterpret_cast<Connection*>(conn);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/query/data_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/data_query.cpp 
b/modules/platforms/cpp/odbc/src/query/data_query.cpp
index e7bf5a0..8b80a29 100644
--- a/modules/platforms/cpp/odbc/src/query/data_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/data_query.cpp
@@ -112,14 +112,12 @@ namespace ignite
                     if (it == columnBindings.end())
                         continue;
 
-                    SqlResult::Type result = row->ReadColumnToBuffer(i, 
it->second);
+                    app::ConversionResult::Type convRes = 
row->ReadColumnToBuffer(i, it->second);
 
-                    if (result == SqlResult::AI_ERROR)
-                    {
-                        diag.AddStatusRecord(SqlState::S01S01_ERROR_IN_ROW, 
"Can not retrieve row column.", 0, i);
+                    SqlResult::Type result = ProcessConversionResult(convRes, 
0, i);
 
+                    if (result == SqlResult::AI_ERROR)
                         return SqlResult::AI_ERROR;
-                    }
                 }
 
                 return SqlResult::AI_SUCCESS;
@@ -144,14 +142,9 @@ namespace ignite
                     return SqlResult::AI_ERROR;
                 }
 
-                SqlResult::Type result = row->ReadColumnToBuffer(columnIdx, 
buffer);
-
-                if (result == SqlResult::AI_ERROR)
-                {
-                    diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, 
"Unknown column type.");
+                app::ConversionResult::Type convRes = 
row->ReadColumnToBuffer(columnIdx, buffer);
 
-                    return SqlResult::AI_ERROR;
-                }
+                SqlResult::Type result = ProcessConversionResult(convRes, 0, 
columnIdx);
 
                 return result;
             }
@@ -396,6 +389,66 @@ namespace ignite
 
                 return SqlResult::AI_SUCCESS;
             }
+
+            SqlResult::Type 
DataQuery::ProcessConversionResult(app::ConversionResult::Type convRes, int32_t 
rowIdx,
+                int32_t columnIdx)
+            {
+                switch (convRes)
+                {
+                    case app::ConversionResult::AI_SUCCESS:
+                    {
+                        return SqlResult::AI_SUCCESS;
+                    }
+
+                    case app::ConversionResult::AI_NO_DATA:
+                    {
+                        return SqlResult::AI_NO_DATA;
+                    }
+
+                    case app::ConversionResult::AI_VARLEN_DATA_TRUNCATED:
+                    {
+                        diag.AddStatusRecord(SqlState::S01004_DATA_TRUNCATED,
+                            "Buffer is too small for the column data. 
Truncated from the right.", rowIdx, columnIdx);
+
+                        return SqlResult::AI_SUCCESS_WITH_INFO;
+                    }
+
+                    case app::ConversionResult::AI_FRACTIONAL_TRUNCATED:
+                    {
+                        
diag.AddStatusRecord(SqlState::S01S07_FRACTIONAL_TRUNCATION,
+                            "Buffer is too small for the column data. Fraction 
truncated.", rowIdx, columnIdx);
+
+                        return SqlResult::AI_SUCCESS_WITH_INFO;
+                    }
+
+                    case app::ConversionResult::AI_INDICATOR_NEEDED:
+                    {
+                        diag.AddStatusRecord(SqlState::S22002_INDICATOR_NEEDED,
+                            "Indicator is needed but not suplied for the 
column buffer.", rowIdx, columnIdx);
+
+                        return SqlResult::AI_SUCCESS_WITH_INFO;
+                    }
+
+                    case app::ConversionResult::AI_UNSUPPORTED_CONVERSION:
+                    {
+                        
diag.AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+                            "Data conversion is not supported.", rowIdx, 
columnIdx);
+
+                        return SqlResult::AI_SUCCESS_WITH_INFO;
+                    }
+
+                    case app::ConversionResult::AI_FAILURE:
+                    default:
+                    {
+                        diag.AddStatusRecord(SqlState::S01S01_ERROR_IN_ROW,
+                            "Can not retrieve row column.", rowIdx, columnIdx);
+
+                        break;
+                    }
+                }
+
+                return SqlResult::AI_ERROR;
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/row.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/row.cpp 
b/modules/platforms/cpp/odbc/src/row.cpp
index 34b061b..f639b64 100644
--- a/modules/platforms/cpp/odbc/src/row.cpp
+++ b/modules/platforms/cpp/odbc/src/row.cpp
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-#include <ignite/impl/interop/interop_stream_position_guard.h>
-
 #include "ignite/odbc/utility.h"
 #include "ignite/odbc/row.h"
 
@@ -74,13 +72,10 @@ namespace ignite
             return true;
         }
 
-        SqlResult::Type Row::ReadColumnToBuffer(uint16_t columnIdx, 
app::ApplicationDataBuffer& dataBuf)
+        app::ConversionResult::Type Row::ReadColumnToBuffer(uint16_t 
columnIdx, app::ApplicationDataBuffer& dataBuf)
         {
-            using namespace ignite::impl::binary;
-            using namespace ignite::impl::interop;
-
             if (!EnsureColumnDiscovered(columnIdx))
-                return SqlResult::AI_ERROR;
+                return app::ConversionResult::AI_FAILURE;
 
             Column& column = GetColumn(columnIdx);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/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 332487e..be6ae2f 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -41,6 +41,7 @@ namespace ignite
             connection(parent),
             columnBindings(),
             currentQuery(),
+            rowBindType(SQL_BIND_BY_COLUMN),
             rowsFetched(0),
             rowStatuses(0),
             columnBindOffset(0),
@@ -243,6 +244,13 @@ namespace ignite
                     break;
                 }
 
+                case SQL_ATTR_ROW_BIND_TYPE:
+                {
+                    rowBindType = reinterpret_cast<SqlUlen>(value);
+
+                    break;
+                }
+
                 case SQL_ATTR_ROWS_FETCHED_PTR:
                 {
                     SetRowsFetchedPtr(reinterpret_cast<size_t*>(value));
@@ -357,6 +365,15 @@ namespace ignite
                     break;
                 }
 
+                case SQL_ATTR_ROW_BIND_TYPE:
+                {
+                    SqlUlen* val = reinterpret_cast<SqlUlen*>(buf);
+
+                    *val = rowBindType;
+
+                    break;
+                }
+
                 case SQL_ATTR_ROW_ARRAY_SIZE:
                 {
                     SQLINTEGER *val = reinterpret_cast<SQLINTEGER*>(buf);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e28f68ec/modules/platforms/cpp/odbc/src/type_traits.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/type_traits.cpp 
b/modules/platforms/cpp/odbc/src/type_traits.cpp
index bff21d1..f5b29c3 100644
--- a/modules/platforms/cpp/odbc/src/type_traits.cpp
+++ b/modules/platforms/cpp/odbc/src/type_traits.cpp
@@ -20,22 +20,13 @@
 #include "ignite/odbc/system/odbc_constants.h"
 #include "ignite/odbc/type_traits.h"
 
-namespace
-{
-    /** Default display size. */
-    enum { DEFAULT_DISPLAY_SIZE = 34 };
-
-    /** Default variable size data display size. */
-    enum { DEFAULT_VARDATA_DISPLAY_SIZE = 64 };
-}
-
 namespace ignite
 {
     namespace odbc
     {
         namespace type_traits
         {
-            const std::string SqlTypeName::VARCHAR("LONG VARCHAR");
+            const std::string SqlTypeName::VARCHAR("VARCHAR");
 
             const std::string SqlTypeName::SMALLINT("SMALLINT");
 
@@ -53,7 +44,7 @@ namespace ignite
 
             const std::string SqlTypeName::BIGINT("BIGINT");
 
-            const std::string SqlTypeName::BINARY("LONG VARBINARY");
+            const std::string SqlTypeName::BINARY("VARBINARY");
 
             const std::string SqlTypeName::DATE("DATE");
 
@@ -63,7 +54,7 @@ namespace ignite
 
             const std::string SqlTypeName::GUID("GUID");
 
-#ifdef ODBC_DEBUG
+#ifdef _DEBUG
 
 #define DBG_STR_CASE(x) case x: return #x
 
@@ -111,7 +102,7 @@ namespace ignite
             }
 
 #undef DBG_STR_CASE
-#endif
+#endif // _DEBUG
 
             const std::string& BinaryTypeToSqlTypeName(int8_t binaryType)
             {
@@ -448,8 +439,13 @@ namespace ignite
                     case SQL_VARCHAR:
                     case SQL_CHAR:
                     case SQL_WCHAR:
+                    case SQL_LONGVARBINARY:
                     case SQL_BINARY:
-                        return DEFAULT_VARDATA_DISPLAY_SIZE;
+                    case SQL_VARBINARY:
+                    case SQL_LONGVARCHAR:
+                    case SQL_DECIMAL:
+                    case SQL_NUMERIC:
+                        return SQL_NO_TOTAL;
 
                     case SQL_BIT:
                         return 1;
@@ -485,10 +481,8 @@ namespace ignite
                     case SQL_GUID:
                         return 36;
 
-                    case SQL_DECIMAL:
-                    case SQL_NUMERIC:
                     default:
-                        return DEFAULT_DISPLAY_SIZE;
+                        return SQL_NO_TOTAL;
                 }
             }
 
@@ -506,8 +500,13 @@ namespace ignite
                     case SQL_VARCHAR:
                     case SQL_CHAR:
                     case SQL_WCHAR:
+                    case SQL_LONGVARBINARY:
                     case SQL_BINARY:
-                        return DEFAULT_VARDATA_DISPLAY_SIZE;
+                    case SQL_VARBINARY:
+                    case SQL_LONGVARCHAR:
+                    case SQL_DECIMAL:
+                    case SQL_NUMERIC:
+                        return SQL_NO_TOTAL;
 
                     case SQL_BIT:
                         return 1;
@@ -543,10 +542,8 @@ namespace ignite
                     case SQL_GUID:
                         return 36;
 
-                    case SQL_DECIMAL:
-                    case SQL_NUMERIC:
                     default:
-                        return DEFAULT_DISPLAY_SIZE;
+                        return SQL_NO_TOTAL;
                 }
             }
 
@@ -564,8 +561,13 @@ namespace ignite
                     case SQL_VARCHAR:
                     case SQL_CHAR:
                     case SQL_WCHAR:
+                    case SQL_LONGVARBINARY:
                     case SQL_BINARY:
-                        return DEFAULT_VARDATA_DISPLAY_SIZE;
+                    case SQL_VARBINARY:
+                    case SQL_LONGVARCHAR:
+                    case SQL_DECIMAL:
+                    case SQL_NUMERIC:
+                        return SQL_NO_TOTAL;
 
                     case SQL_BIT:
                     case SQL_TINYINT:
@@ -597,10 +599,8 @@ namespace ignite
                     case SQL_GUID:
                         return 16;
 
-                    case SQL_DECIMAL:
-                    case SQL_NUMERIC:
                     default:
-                        return DEFAULT_DISPLAY_SIZE;
+                        return SQL_NO_TOTAL;
                 }
             }
 

Reply via email to