ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [12/50] ignite git commit: IGNITE-2223: SQL types constants separated.
Date Mon, 25 Jan 2016 11:55:14 GMT
IGNITE-2223: SQL types constants separated.


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

Branch: refs/heads/ignite-1786
Commit: 0b8487f1b6908d396c1a3c76acb7fa66176b1b2a
Parents: f4ccbe6
Author: isapego <isapego@gridgain.com>
Authored: Tue Jan 12 18:06:51 2016 +0300
Committer: isapego <isapego@gridgain.com>
Committed: Tue Jan 12 18:06:51 2016 +0300

----------------------------------------------------------------------
 .../include/ignite/odbc/common_types.h          | 18 ++++++++++++
 .../cpp/odbc/odbc-driver/src/common_types.cpp   |  6 ++++
 .../src/query/column_metadata_query.cpp         | 28 ++++++++----------
 .../src/query/foreign_keys_query.cpp            | 31 +++++++++-----------
 .../src/query/primary_keys_query.cpp            | 15 ++++------
 .../src/query/table_metadata_query.cpp          | 12 ++++----
 .../platforms/cpp/odbc/odbc-driver/src/row.cpp  |  3 +-
 .../cpp/odbc/odbc-driver/src/utility.cpp        |  4 ++-
 8 files changed, 66 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/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 c656fae..a364791 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
@@ -20,11 +20,29 @@
 
 #include <stdint.h>
 
+#include <string>
+
 namespace ignite
 {
     namespace odbc
     {
         /**
+         * SQL type name constants.
+         */
+        class SqlTypeName
+        {
+        public:
+            /** VARCHAR SQL type name constant. */
+            static const std::string varcharType;
+
+            /** SMALLINT SQL type name constant. */
+            static const std::string smallintType;
+
+            /** INTEGER SQL type name constant. */
+            static const std::string integerType;
+        };
+
+        /**
          * SQL result.
          */
         enum SqlResult

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/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 2b7144b..db2353d 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/common_types.cpp
@@ -22,6 +22,12 @@ namespace ignite
 {
     namespace odbc
     {
+        const std::string SqlTypeName::varcharType("VARCHAR");
+
+        const std::string SqlTypeName::smallintType("SMALLINT");
+
+        const std::string SqlTypeName::integerType("INTEGER");
+
         int SqlResultToReturnCode(SqlResult result)
         {
             switch (result)

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp
index de531f2..458679a 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/column_metadata_query.cpp
@@ -90,22 +90,18 @@ namespace ignite
                 const std::string sch("");
                 const std::string tbl("");
 
-                const std::string varcharType("java.lang.String");
-                const std::string smallintType("java.lang.Short");
-                const std::string integerType("java.lang.Integer");
-
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",      varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM",    varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",     varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_NAME",    varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "DATA_TYPE",      smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TYPE_NAME",      varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_SIZE",    integerType,
 IGNITE_TYPE_INT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "BUFFER_LENGTH",  integerType,
 IGNITE_TYPE_INT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "DECIMAL_DIGITS", smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "NUM_PREC_RADIX", smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "NULLABLE",       smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "REMARKS",        varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",      SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM",    SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",     SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_NAME",    SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "DATA_TYPE",      SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TYPE_NAME",      SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_SIZE",    SqlTypeName::integerType,
 IGNITE_TYPE_INT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "BUFFER_LENGTH",  SqlTypeName::integerType,
 IGNITE_TYPE_INT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "DECIMAL_DIGITS", SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "NUM_PREC_RADIX", SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "NULLABLE",       SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "REMARKS",        SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
             }
 
             ColumnMetadataQuery::~ColumnMetadataQuery()

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/query/foreign_keys_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/foreign_keys_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/foreign_keys_query.cpp
index 720a6a3..33cc440 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/query/foreign_keys_query.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/foreign_keys_query.cpp
@@ -51,23 +51,20 @@ namespace ignite
                 const std::string sch("");
                 const std::string tbl("");
 
-                const std::string varcharType("java.lang.String");
-                const std::string smallintType("java.lang.Short");
-
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_CAT",   varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_SCHEM", varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_NAME",  varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKCOLUMN_NAME", varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_CAT",   varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_SCHEM", varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_NAME",  varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKCOLUMN_NAME", varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "KEY_SEQ",       smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "UPDATE_RULE",   smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "DELETE_RULE",   smallintType,
IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "FK_NAME",       varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PK_NAME",       varcharType,
 IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "DEFERRABILITY", smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_CAT",   SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_SCHEM", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKTABLE_NAME",  SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PKCOLUMN_NAME", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_CAT",   SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_SCHEM", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKTABLE_NAME",  SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "FKCOLUMN_NAME", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "KEY_SEQ",       SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "UPDATE_RULE",   SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "DELETE_RULE",   SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "FK_NAME",       SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PK_NAME",       SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "DEFERRABILITY", SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
             }
 
             ForeignKeysQuery::~ForeignKeysQuery()

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/query/primary_keys_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/primary_keys_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/primary_keys_query.cpp
index 0b9b523..27e76ac 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/query/primary_keys_query.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/primary_keys_query.cpp
@@ -71,15 +71,12 @@ namespace ignite
                 const std::string sch("");
                 const std::string tbl("");
 
-                const std::string varcharType("java.lang.String");
-                const std::string smallintType("java.lang.Short");
-
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",   varcharType,  IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM", varcharType,  IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",  varcharType,  IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_NAME", varcharType,  IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "KEY_SEQ",     smallintType, IGNITE_TYPE_SHORT));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "PK_NAME",     varcharType,  IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",   SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",  SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "COLUMN_NAME", SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "KEY_SEQ",     SqlTypeName::smallintType,
IGNITE_TYPE_SHORT));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "PK_NAME",     SqlTypeName::varcharType,
 IGNITE_TYPE_STRING));
             }
 
             PrimaryKeysQuery::~PrimaryKeysQuery()

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp
index 1d1d747..e07da2e 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/query/table_metadata_query.cpp
@@ -70,13 +70,11 @@ namespace ignite
                 const std::string sch("");
                 const std::string tbl("");
 
-                const std::string varcharType("java.lang.String");
-
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",   varcharType, IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM", varcharType, IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",  varcharType, IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_TYPE",  varcharType, IGNITE_TYPE_STRING));
-                columnsMeta.push_back(ColumnMeta(sch, tbl, "REMARKS",     varcharType, IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_CAT",   SqlTypeName::varcharType,
IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_SCHEM", SqlTypeName::varcharType,
IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_NAME",  SqlTypeName::varcharType,
IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "TABLE_TYPE",  SqlTypeName::varcharType,
IGNITE_TYPE_STRING));
+                columnsMeta.push_back(ColumnMeta(sch, tbl, "REMARKS",     SqlTypeName::varcharType,
IGNITE_TYPE_STRING));
             }
 
             TableMetadataQuery::~TableMetadataQuery()

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/row.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/row.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/row.cpp
index c1ddcb1..d048674 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/row.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/row.cpp
@@ -213,7 +213,7 @@ namespace ignite
 
                     utility::ReadDecimal(reader, res);
 
-                    //dataBuf.putDecimal(res);
+                    dataBuf.PutDecimal(res);
 
                     break;
                 }
@@ -296,6 +296,7 @@ namespace ignite
                 case IGNITE_TYPE_UUID:
                 {
                     Guid guid = reader.ReadGuid();
+
                     break;
                 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b8487f1/modules/platforms/cpp/odbc/odbc-driver/src/utility.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/utility.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/utility.cpp
index c7210c3..6f4ac22 100644
--- a/modules/platforms/cpp/odbc/odbc-driver/src/utility.cpp
+++ b/modules/platforms/cpp/odbc/odbc-driver/src/utility.cpp
@@ -17,6 +17,8 @@
 
 #include <cassert>
 
+#include <ignite/impl/binary/binary_utils.h>
+
 #include "ignite/odbc/utility.h"
 #include "ignite/odbc/system/odbc_constants.h"
 
@@ -75,7 +77,7 @@ namespace ignite
 
             mag.resize(len);
 
-            reader.ReadInt8Array(mag.data(), static_cast<int32_t>(mag.size()));
+            impl::binary::BinaryUtils::ReadInt8Array(reader.GetStream(), mag.data(), static_cast<int32_t>(mag.size()));
 
             Decimal res(scale, mag.data(), static_cast<int32_t>(mag.size()));
 


Mime
View raw message