ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/4] incubator-ignite git commit: ignite-1263 Fixed timestamp and CLOB type detection. Closes #21.
Date Thu, 20 Aug 2015 11:14:39 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-10606 53143f932 -> 3310db271


ignite-1263 Fixed timestamp and CLOB type detection. Closes #21.


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

Branch: refs/heads/ignite-gg-10606
Commit: e9a0d06ffa104c0e54e0e95b0af229f7648d22d1
Parents: 09da9c2
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Wed Aug 19 14:33:52 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Wed Aug 19 14:33:52 2015 +0700

----------------------------------------------------------------------
 .../ignite/schema/model/PojoDescriptor.java     |   6 +-
 .../parser/dialect/OracleMetadataDialect.java   | 101 ++++++++++---------
 2 files changed, 57 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e9a0d06f/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
index 5e1da06..5a4a1fa 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
@@ -504,7 +504,11 @@ public class PojoDescriptor {
             case TIMESTAMP:
                 return java.sql.Timestamp.class;
 
-            // BINARY, VARBINARY, LONGVARBINARY, ARRAY, BLOB, CLOB, NCLOB, NULL, DATALINK
+            case CLOB:
+            case NCLOB:
+                return String.class;
+
+            // BINARY, VARBINARY, LONGVARBINARY, ARRAY, BLOB, NULL, DATALINK
             // OTHER, JAVA_OBJECT, DISTINCT, STRUCT, REF, ROWID, SQLXML
             default:
                 return Object.class;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e9a0d06f/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
index 860ff68..30dda5d 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
@@ -87,73 +87,76 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
      * @throws SQLException If failed to decode type.
      */
     private int decodeType(ResultSet rs) throws SQLException {
-        switch (rs.getString(DATA_TYPE_IDX)) {
-            case "CHAR":
-            case "NCHAR":
-                return CHAR;
+        String type = rs.getString(DATA_TYPE_IDX);
 
-            case "VARCHAR2":
-            case "NVARCHAR2":
-                return VARCHAR;
+        if (type.startsWith("TIMESTAMP"))
+            return TIMESTAMP;
+        else {
+            switch (type) {
+                case "CHAR":
+                case "NCHAR":
+                    return CHAR;
 
-            case "LONG":
-                return LONGVARCHAR;
+                case "VARCHAR2":
+                case "NVARCHAR2":
+                    return VARCHAR;
 
-            case "LONG RAW":
-                return LONGVARBINARY;
+                case "LONG":
+                    return LONGVARCHAR;
 
-            case "FLOAT":
-                return FLOAT;
+                case "LONG RAW":
+                    return LONGVARBINARY;
 
-            case "NUMBER":
-                int precision = rs.getInt(DATA_PRECISION_IDX);
-                int scale = rs.getInt(DATA_SCALE_IDX);
+                case "FLOAT":
+                    return FLOAT;
 
-                if (scale > 0) {
-                    if (scale < 4 && precision < 19)
-                        return FLOAT;
+                case "NUMBER":
+                    int precision = rs.getInt(DATA_PRECISION_IDX);
+                    int scale = rs.getInt(DATA_SCALE_IDX);
 
-                    if (scale > 4 || precision > 19)
-                        return DOUBLE;
+                    if (scale > 0) {
+                        if (scale < 4 && precision < 19)
+                            return FLOAT;
 
-                    return NUMERIC;
-                }
-                else {
-                    if (precision < 1)
-                        return INTEGER;
+                        if (scale > 4 || precision > 19)
+                            return DOUBLE;
 
-                    if (precision < 2)
-                        return BOOLEAN;
+                        return NUMERIC;
+                    }
+                    else {
+                        if (precision < 1)
+                            return INTEGER;
 
-                    if (precision < 4)
-                        return TINYINT;
+                        if (precision < 2)
+                            return BOOLEAN;
 
-                    if (precision < 6)
-                        return SMALLINT;
+                        if (precision < 4)
+                            return TINYINT;
 
-                    if (precision < 11)
-                        return INTEGER;
+                        if (precision < 6)
+                            return SMALLINT;
 
-                    if (precision < 20)
-                        return BIGINT;
+                        if (precision < 11)
+                            return INTEGER;
 
-                    return NUMERIC;
-                }
+                        if (precision < 20)
+                            return BIGINT;
 
-            case "DATE":
-                return DATE;
+                        return NUMERIC;
+                    }
 
-            case "TIMESTAMP":
-                return TIMESTAMP;
+                case "DATE":
+                    return DATE;
 
-            case "BFILE":
-            case "BLOB":
-                return BLOB;
+                case "BFILE":
+                case "BLOB":
+                    return BLOB;
 
-            case "CLOB":
-            case "NCLOB":
-            case "XMLTYPE":
-                return CLOB;
+                case "CLOB":
+                case "NCLOB":
+                case "XMLTYPE":
+                    return CLOB;
+            }
         }
 
         return OTHER;


Mime
View raw message