cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cassandra-jdbc.apache-extras....@codespot.com
Subject [cassandra-jdbc] push by wfs...@gmail.com - Tune up some omissions from Issue#40 patch providef by Jan Blok on 2013-03-25 17:30 GMT
Date Mon, 25 Mar 2013 17:30:56 GMT
Revision: fee18ca56fb7
Author:   Rick Shaw <wfshaw@gmail.com>
Date:     Mon Mar 25 10:30:37 2013
Log:      Tune up some omissions from Issue#40 patch providef by Jan Blok
http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/detail?r=fee18ca56fb7

Modified:
  /src/main/java/org/apache/cassandra/cql/jdbc/MetadataResultSets.java
  /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java
  /src/test/java/org/apache/cassandra/cql/jdbc/MetadataResultSetsTest.java

=======================================
--- /src/main/java/org/apache/cassandra/cql/jdbc/MetadataResultSets.java	 
Thu Mar 21 11:40:54 2013
+++ /src/main/java/org/apache/cassandra/cql/jdbc/MetadataResultSets.java	 
Mon Mar 25 10:30:37 2013
@@ -46,9 +46,6 @@

  public  class MetadataResultSets
  {
-
-    private static final String UTF8_TYPE = "UTF8Type";
-    private static final String ASCII_TYPE = "AsciiType";
      static final String TABLE_CONSTANT = "TABLE";

      public static final MetadataResultSets instance = new  
MetadataResultSets();
@@ -203,7 +200,7 @@
          String query = "SELECT keyspace_name FROM system.schema_keyspaces";
          if (schemaPattern!=null) query = query + " where keyspace_name  
= '" + schemaPattern + "'";

-        String catalog = statement.connection.cluster;
+        String catalog = statement.connection.getCatalog();
          Entry entryC = new  
Entry("TABLE_CATALOG",bytes(catalog),Entry.ASCII_TYPE);

          CassandraResultSet result;
=======================================
--- /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java	 
Thu Mar 21 11:40:54 2013
+++ /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java	 
Mon Mar 25 10:30:37 2013
@@ -414,9 +414,6 @@

      }

-
-
-
      @Test
      public void isValid() throws Exception
      {
@@ -439,7 +436,6 @@
          assert con.isValid(5) == false;
          ((CassandraConnection) con).isAlive = currentStatement;
      }
-

      private final String  showColumn(int index, ResultSet result) throws  
SQLException
      {
=======================================
---  
/src/test/java/org/apache/cassandra/cql/jdbc/MetadataResultSetsTest.java	 
Thu Mar 21 11:40:54 2013
+++  
/src/test/java/org/apache/cassandra/cql/jdbc/MetadataResultSetsTest.java	 
Mon Mar 25 10:30:37 2013
@@ -116,12 +116,6 @@
          return sb.toString();
      }

-    private final String showRow(ResultSet result) throws SQLException
-    {
-        StringBuilder sb = new StringBuilder();
-        return sb.toString();
-    }
-
      private final String toString(ResultSet result) throws SQLException
      {
         StringBuilder sb = new StringBuilder();
@@ -182,13 +176,12 @@
          ResultSet result =  
MetadataResultSets.instance.makeSchemas(statement, null);

          System.out.println("--- testSchemas() ---");
-        System.out.println(result.getMetaData().getColumnName(1));
-        System.out.println(result.getMetaData().getColumnName(2));
+        System.out.println(getColumnNames(result.getMetaData()));

          System.out.println(toString(result));
          System.out.println();

-        result =  
MetadataResultSets.instance.makeSchemas(statement, "testks2");
+        result = MetadataResultSets.instance.makeSchemas(statement,  
KEYSPACE2);
          System.out.println(toString(result));
          System.out.println();
      }
@@ -200,16 +193,12 @@
          ResultSet result =  
MetadataResultSets.instance.makeTables(statement, null, null);

          System.out.println("--- testTables() ---");
-        System.out.println(result.getMetaData().getColumnName(1));
-        System.out.println(result.getMetaData().getColumnName(2));
-        System.out.println(result.getMetaData().getColumnName(3));
-        System.out.println(result.getMetaData().getColumnName(4));
-        System.out.println(result.getMetaData().getColumnName(5));
+        System.out.println(getColumnNames(result.getMetaData()));

          System.out.println(toString(result));
          System.out.println();

-        result =  
MetadataResultSets.instance.makeTables(statement, "testks2", null);
+        result = MetadataResultSets.instance.makeTables(statement,  
KEYSPACE2, null);
          System.out.println(toString(result));
          System.out.println();

@@ -217,9 +206,29 @@
          System.out.println(toString(result));
          System.out.println();

-        result =  
MetadataResultSets.instance.makeTables(statement, "testks2", "test1");
+        result = MetadataResultSets.instance.makeTables(statement,  
KEYSPACE2, "test1");
          System.out.println(toString(result));
          System.out.println();
      }

+    @Test
+    public void testColumns() throws SQLException
+    {
+        CassandraStatement statement = (CassandraStatement)  
con.createStatement();
+        ResultSet result =  
MetadataResultSets.instance.makeColumns(statement,  
KEYSPACE1, "test1" ,null);
+
+        System.out.println("--- testColumns() ---");
+        System.out.println(getColumnNames(result.getMetaData()));
+
+        System.out.println(toString(result));
+        System.out.println();
+
+        result = MetadataResultSets.instance.makeColumns(statement,  
KEYSPACE1, "test2" ,null);
+
+        System.out.println("--- testColumns() ---");
+        System.out.println(getColumnNames(result.getMetaData()));
+
+        System.out.println(toString(result));
+        System.out.println();
+    }
  }

Mime
View raw message