IGNITE-2243: Implemented EnvironmentAttribute.

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

Branch: refs/heads/ignite-1786
Commit: a172649ff3979c5a51ba291cbe8a083d09dee397
Parents: 7037069
Author: isapego <[email protected]>
Authored: Wed Jan 20 20:45:42 2016 +0300
Committer: isapego <[email protected]>
Committed: Wed Jan 20 20:45:42 2016 +0300

----------------------------------------------------------------------
 .../include/ignite/odbc/common_types.h          | 26 +++++++++++++++++---
 .../cpp/odbc/odbc-driver/src/common_types.cpp   | 16 +++++++++++-
 .../cpp/odbc/odbc-driver/src/environment.cpp    | 10 ++++++--
 3 files changed, 46 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a172649f/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h
----------------------------------------------------------------------
diff --git 
a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h 
b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h
index 1d007fb..2e64857 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h
+++ b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/common_types.h
@@ -117,6 +117,9 @@ namespace ignite
          */
         enum DiagnosticField
         {
+            /** Field type is unknown to the driver. */
+            IGNITE_SQL_DIAG_UNKNOWN,
+
             /** Header record field: Count of rows in the cursor. */
             IGNITE_SQL_DIAG_HEADER_CURSOR_ROW_COUNT,
 
@@ -166,10 +169,19 @@ namespace ignite
             IGNITE_SQL_DIAG_STATUS_SQLSTATE,
 
             /** Status record field: Subclass origin. */
-            IGNITE_SQL_DIAG_STATUS_SUBCLASS_ORIGIN,
+            IGNITE_SQL_DIAG_STATUS_SUBCLASS_ORIGIN
+        };
 
-            /** Field type is unknown to the driver. */
-            IGNITE_SQL_DIAG_UNKNOWN
+        /**
+         * Environment attribute.
+         */
+        enum EnvironmentAttribute
+        {
+            /** ODBC attribute is unknown to the driver. */
+            IGNITE_SQL_ENV_ATTR_UNKNOWN,
+
+            /** ODBC attribute. */
+            IGNITE_SQL_ENV_ATTR_ODBC_VERSION
         };
 
         /**
@@ -187,6 +199,14 @@ namespace ignite
          * @return Internal DiagnosticField type value.
          */
         DiagnosticField DiagnosticFieldToInternal(int16_t field);
+
+        /**
+         * Convert environment attribute to internal EnvironmentAttribute type 
value.
+         *
+         * @param attr Environment attribute.
+         * @return Internal EnvironmentAttribute type value.
+         */
+        EnvironmentAttribute EnvironmentAttributeToInternal(int32_t attr);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a172649f/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp 
b/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
index 9086321..83bfe4c 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
@@ -24,7 +24,6 @@ namespace ignite
 {
     namespace odbc
     {
-
         int SqlResultToReturnCode(SqlResult result)
         {
             switch (result)
@@ -96,8 +95,23 @@ namespace ignite
                 default:
                     break;
             }
+
             return IGNITE_SQL_DIAG_UNKNOWN;
         }
+
+        EnvironmentAttribute EnvironmentAttributeToInternal(int32_t attr)
+        {
+            switch (attr)
+            {
+                case SQL_ATTR_ODBC_VERSION:
+                    return IGNITE_SQL_ENV_ATTR_ODBC_VERSION;
+
+                default:
+                    break;
+            }
+
+            return IGNITE_SQL_ENV_ATTR_UNKNOWN;
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a172649f/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp 
b/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp
index c5e4808..186fdc1 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/environment.cpp
@@ -85,7 +85,10 @@ namespace ignite
 
         SqlResult Environment::InternalSetAttribute(int32_t attr, void* value, 
int32_t len)
         {
-            return SQL_RESULT_SUCCESS;
+            AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+                "Attribute is not supported.");
+
+            return SQL_RESULT_ERROR;
         }
 
         void Environment::GetAttribute(int32_t attr, 
app::ApplicationDataBuffer& buffer)
@@ -95,7 +98,10 @@ namespace ignite
 
         SqlResult Environment::InternalGetAttribute(int32_t attr, 
app::ApplicationDataBuffer& buffer)
         {
-            return SQL_RESULT_SUCCESS;
+            AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+                "Attribute is not supported.");
+
+            return SQL_RESULT_ERROR;
         }
     }
 }

Reply via email to