You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2017/08/15 18:00:09 UTC
[08/29] ignite git commit: IGNITE-5939: ODBC: SQLColAttributes now
works with legacy attribute codes.
IGNITE-5939: ODBC: SQLColAttributes now works with legacy attribute codes.
(cherry picked from commit 70ffa2c)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4e0385fb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4e0385fb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4e0385fb
Branch: refs/heads/ignite-5947
Commit: 4e0385fbc0f50548f2da3407fdfdfe939b463c67
Parents: 0b3a9a7
Author: Igor Sapego <is...@gridgain.com>
Authored: Fri Aug 4 18:34:27 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Fri Aug 4 18:36:46 2017 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/meta_queries_test.cpp | 51 ++++++++++++++++++++
.../platforms/cpp/odbc/src/meta/column_meta.cpp | 3 ++
2 files changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e0385fb/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp b/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp
index 5b7ae59..454a989 100644
--- a/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp
@@ -186,4 +186,55 @@ BOOST_AUTO_TEST_CASE(TestGetTypeInfoAllTypes)
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
}
+BOOST_AUTO_TEST_CASE(TestColAttributesColumnLength)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ SQLCHAR req[] = "select strField from TestType";
+ SQLExecDirect(stmt, req, SQL_NTS);
+
+ SQLLEN intVal;
+ SQLCHAR strBuf[1024];
+ SQLSMALLINT strLen;
+
+ SQLRETURN ret = SQLColAttribute(stmt, 1, SQL_COLUMN_LENGTH, strBuf, sizeof(strBuf), &strLen, &intVal);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+}
+
+BOOST_AUTO_TEST_CASE(TestColAttributesColumnPresicion)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ SQLCHAR req[] = "select strField from TestType";
+ SQLExecDirect(stmt, req, SQL_NTS);
+
+ SQLLEN intVal;
+ SQLCHAR strBuf[1024];
+ SQLSMALLINT strLen;
+
+ SQLRETURN ret = SQLColAttribute(stmt, 1, SQL_COLUMN_PRECISION, strBuf, sizeof(strBuf), &strLen, &intVal);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+}
+
+BOOST_AUTO_TEST_CASE(TestColAttributesColumnScale)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ SQLCHAR req[] = "select strField from TestType";
+ SQLExecDirect(stmt, req, SQL_NTS);
+
+ SQLLEN intVal;
+ SQLCHAR strBuf[1024];
+ SQLSMALLINT strLen;
+
+ SQLRETURN ret = SQLColAttribute(stmt, 1, SQL_COLUMN_SCALE, strBuf, sizeof(strBuf), &strLen, &intVal);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e0385fb/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 12dbfc1..97fdf80 100644
--- a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
+++ b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
@@ -179,6 +179,7 @@ namespace ignite
case SQL_DESC_LENGTH:
case SQL_DESC_OCTET_LENGTH:
+ case SQL_COLUMN_LENGTH:
{
value = type_traits::BinaryTypeTransferLength(dataType);
@@ -200,6 +201,7 @@ namespace ignite
}
case SQL_DESC_PRECISION:
+ case SQL_COLUMN_PRECISION:
{
value = type_traits::BinaryTypeColumnSize(dataType);
@@ -207,6 +209,7 @@ namespace ignite
}
case SQL_DESC_SCALE:
+ case SQL_COLUMN_SCALE:
{
value = type_traits::BinaryTypeDecimalDigits(dataType);