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 - ... on 2011-12-22 03:38 GMT
Date Thu, 22 Dec 2011 03:40:41 GMT
Revision: 805d8ffdc7bc
Author:   Rick Shaw <wfshaw@gmail.com>
Date:     Tue Dec 20 21:22:20 2011
Log:

Signed-off-by: Rick Shaw <wfshaw@gmail.com>
http://code.google.com/a/apache-extras.org/p/cassandra-jdbc/source/detail?r=805d8ffdc7bc

Modified:
  /pom.xml
  /src/main/java/org/apache/cassandra/cql/jdbc/TypedColumn.java
  /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java

=======================================
--- /pom.xml	Tue Dec 13 12:57:26 2011
+++ /pom.xml	Tue Dec 20 21:22:20 2011
@@ -98,7 +98,7 @@
      <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-thrift</artifactId>
-      <version>1.0.2</version>
+      <version>1.0.6</version>
        <exclusions>
          <exclusion>
            <groupId>javax.servlet</groupId>
@@ -113,7 +113,7 @@
      <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-clientutil</artifactId>
-      <version>1.0.2</version>
+      <version>1.0.6</version>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
=======================================
--- /src/main/java/org/apache/cassandra/cql/jdbc/TypedColumn.java	Thu Oct  
13 00:45:22 2011
+++ /src/main/java/org/apache/cassandra/cql/jdbc/TypedColumn.java	Tue Dec  
20 21:22:20 2011
@@ -21,7 +21,10 @@
   */


+import java.nio.charset.CharacterCodingException;
+
  import org.apache.cassandra.thrift.Column;
+import org.apache.cassandra.utils.ByteBufferUtil;


  public class TypedColumn
@@ -73,4 +76,28 @@
      {
          return valueType;
      }
-}
+
+    public String toString()
+    {
+        return String.format("TypedColumn [rawColumn=%s, value=%s,  
nameString=%s, nameType=%s, valueType=%s]",
+            displayRawColumn(rawColumn),
+            value,
+            nameString,
+            nameType,
+            valueType);
+    }
+    private String displayRawColumn(Column column)
+    {
+        String name;
+        try
+        {
+            name = ByteBufferUtil.string(column.name);
+        }
+        catch (CharacterCodingException e)
+        {
+            name = "<binary>";
+        }
+        String value =  
(column.value==null)? "<null>" :ByteBufferUtil.bytesToHex(column.value);
+        return String.format("Column[name=%s, value=%s]",name,value);
+    }
+}
=======================================
--- /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java	 
Mon Dec 19 09:03:13 2011
+++ /src/test/java/org/apache/cassandra/cql/jdbc/JdbcRegressionTest.java	 
Tue Dec 20 21:22:20 2011
@@ -81,13 +81,19 @@
          Thread.sleep(3000);

          statement = con.createStatement();
-        ResultSet result = statement.executeQuery("SELECT bValue,iValue  
FROM RegressionTest WHERE KEY=key0;");
+        ResultSet result = statement.executeQuery("SELECT  
bValue,notThere,iValue FROM RegressionTest WHERE KEY=key0;");
          result.next();
+
          boolean b = result.getBoolean(1);
-        System.out.println("b ="+ b);
+        System.out.println("b = "+ b);
          assertTrue(b);
-        int i = result.getInt(2);
-        System.out.println("i ="+ i);
+
+        long l = result.getLong("notThere");
+        assertEquals(0,l);
+        System.out.println("l = "+ l + " ... wasNull() = "+  
result.wasNull());
+
+        int i = result.getInt(3);
+        System.out.println("i ="+ i + " ... wasNull() = "+  
result.wasNull());
          assertEquals(2000, i);
     }


Mime
View raw message