ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [03/50] [abbrv] incubator-ignite git commit: # IGNITE-32: Oracle dialect: support for views.
Date Thu, 05 Feb 2015 07:47:29 GMT
# IGNITE-32: Oracle dialect: support for views.


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

Branch: refs/heads/ignite-58
Commit: 6706dbd8b338d72f5cc223c33432116787c3235b
Parents: 091f5c0
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Feb 2 16:27:57 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Feb 2 16:27:57 2015 +0700

----------------------------------------------------------------------
 .../parser/dialect/OracleMetadataDialect.java   | 32 +++++++++++---------
 1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6706dbd8/modules/schema-load/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-load/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
b/modules/schema-load/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
index 304c911..fe8db43 100644
--- a/modules/schema-load/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ b/modules/schema-load/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
@@ -36,10 +36,11 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
         "  (a.table_name = b.table_name AND a.table_owner = b.table_owner AND a.index_name
 = b.index_name)";
 
     /** SQL to get columns metadata. */
-    private static final String SQL_COLUMNS = "SELECT owner, table_name, column_name, nullable,
data_type" +
-        " FROM all_tab_columns" +
-        " WHERE owner = '%s'" +
-        " ORDER BY owner, table_name, column_id";
+    private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name,
a.nullable, a.data_type" +
+        " FROM all_tab_columns a" +
+        " %s" +
+        " WHERE a.owner = '%s'" +
+        " ORDER BY a.owner, a.table_name, a.column_id";
 
     /**
      * @param type Column type from Oracle database.
@@ -101,7 +102,10 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
         try (Statement stmt = conn.createStatement()) {
             Collection<DbColumn> cols = new ArrayList<>();
 
-            try (ResultSet colsRs = stmt.executeQuery(String.format(SQL_COLUMNS, "TEST")))
{
+            String sql = String.format(SQL_COLUMNS,
+                tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name" : "",
"TEST");
+
+            try (ResultSet colsRs = stmt.executeQuery(sql)) {
                 String prevSchema = "";
                 String prevTbl = "";
 
@@ -114,22 +118,20 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
                         prevTbl = tbl;
                     }
 
-                    if (schema.equals(prevSchema) && tbl.equals(prevTbl)) {
-                        cols.add(new DbColumn(colsRs.getString("COLUMN_NAME"),
-                            decodeType(colsRs.getString("DATA_TYPE")),
-                            false,
-                            decodeNullable(colsRs.getString("NULLABLE"))
-                        ));
-                    }
-                    else {
+                    if (!schema.equals(prevSchema) || !tbl.equals(prevTbl)) {
                         tbls.add(new DbTable(prevSchema, prevTbl, cols, Collections.<String>emptySet(),
                             Collections.<String>emptySet(), null));
 
-                        cols = new ArrayList<>();
-
                         prevSchema = schema;
                         prevTbl = tbl;
+
+                        cols = new ArrayList<>();
                     }
+                    cols.add(new DbColumn(colsRs.getString("COLUMN_NAME"),
+                        decodeType(colsRs.getString("DATA_TYPE")),
+                        false,
+                        decodeNullable(colsRs.getString("NULLABLE"))
+                    ));
                 }
 
                 if (!cols.isEmpty())


Mime
View raw message