cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1100827 - in /cassandra/branches/cassandra-0.8/drivers/java: src/org/apache/cassandra/cql/jdbc/ test/org/apache/cassandra/cql/
Date Sun, 08 May 2011 22:32:47 GMT
Author: jbellis
Date: Sun May  8 22:32:47 2011
New Revision: 1100827

URL: http://svn.apache.org/viewvc?rev=1100827&view=rev
Log:
JDBC CQL driver exposes getColumn for access to timestamp
patch by jbellis

Added:
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
      - copied, changed from r1100448, cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java
Removed:
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSetMetaData.java
Modified:
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraStatement.java
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/TypedColumn.java
    cassandra/branches/cassandra-0.8/drivers/java/test/org/apache/cassandra/cql/JdbcDriverTest.java

Copied: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java (from r1100448, cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java)
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java?p2=cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java&p1=cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java&r1=1100448&r2=1100827&rev=1100827&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java (original)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java Sun May  8 22:32:47 2011
@@ -44,23 +44,16 @@ import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.*;
 
-import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.CounterColumnType;
 import org.apache.cassandra.db.marshal.LongType;
 import org.apache.cassandra.thrift.Column;
 import org.apache.cassandra.thrift.CqlResult;
 import org.apache.cassandra.thrift.CqlRow;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
-/**
- * The Class CassandraResultSet.
- */
-class CassandraResultSet implements ResultSet
+public class CResultSet implements CassandraResultSet
 {
-    
-    /** The r set. */
-    private final CqlResult rSet; 
-    
     private final ColumnDecoder decoder;
     private final String keyspace;
     private final String columnFamily;
@@ -78,9 +71,8 @@ class CassandraResultSet implements Resu
     // TODO should map <String, TypedColumn> so we can throw appropriate exception if user asks for non-existant column name
     private Map<String, Object> valueMap = new WeakHashMap<String, Object>();
     
-    private final RsMetaData meta;
+    private final CResultSetMetaData meta;
     
-    private final AbstractType nameType;
     private boolean wasNull;
 
     /**
@@ -88,72 +80,55 @@ class CassandraResultSet implements Resu
      *
      * @param resultSet the result set
      */
-    CassandraResultSet(CqlResult resultSet, ColumnDecoder decoder, String keyspace, String columnFamily)
+    CResultSet(CqlResult resultSet, ColumnDecoder decoder, String keyspace, String columnFamily)
     {
-        this.rSet = resultSet;
         this.decoder = decoder;
         this.keyspace = keyspace;
         this.columnFamily = columnFamily;
-        rSetIter = rSet.getRowsIterator();
-        meta = new RsMetaData();
-        nameType = decoder.getComparator(keyspace, columnFamily, ColumnDecoder.Specifier.Comparator, null);
+        rSetIter = resultSet.getRowsIterator();
+        meta = new CResultSetMetaData();
     }
 
-    /**
-     * @param iface
-     * @return
-     * @throws SQLException
-     */
-    public boolean isWrapperFor(Class<?> iface) throws SQLException
+    public byte[] getKey()
     {
-        return false;
+        return curRowKey;
+    }
+
+    public TypedColumn getColumn(int i)
+    {
+        return values.get(i);
+    }
+
+    public TypedColumn getColumn(String name)
+    {
+        throw new UnsupportedOperationException("need to convert valueMap to TypedColumn first");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public boolean absolute(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void afterLast() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void beforeFirst() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void cancelRowUpdates() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void clearWarnings() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void close() throws SQLException
     {
         valueMap.clear();
@@ -162,257 +137,133 @@ class CassandraResultSet implements Resu
         values = null;
     }
 
-    /**
-     * @throws SQLException
-     */
     public void deleteRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public int findColumn(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean first() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Array getArray(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Array getArray(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getAsciiStream(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getAsciiStream(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public BigDecimal getBigDecimal(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public BigDecimal getBigDecimal(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public BigDecimal getBigDecimal(String arg0, int arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getBinaryStream(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getBinaryStream(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Blob getBlob(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Blob getBlob(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public boolean getBoolean(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public boolean getBoolean(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public byte getByte(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public byte getByte(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param index
-     * @return
-     * @throws SQLException
-     */
     public byte[] getBytes(int index) throws SQLException
     {
         TypedColumn column = values.get(index - 1);
         assert column != null;
         Object value = column.getValue();
         wasNull = value == null;
-        return value == null ? null : ((ByteBuffer) value).array();
+        return value == null ? null : ByteBufferUtil.clone((ByteBuffer) value).array();
     }
 
-    /**
-     * @param name
-     * @return
-     * @throws SQLException
-     */
     public byte[] getBytes(String name) throws SQLException
     {
         String nameAsString = decoder.colNameAsString(keyspace, columnFamily, name);
         Object value = valueMap.get(nameAsString);
         wasNull = value == null;
-        return value == null ? null : ((ByteBuffer) value).array();
+        return value == null ? null : ByteBufferUtil.clone((ByteBuffer) value).array();
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Reader getCharacterStream(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Reader getCharacterStream(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Clob getClob(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Clob getClob(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
@@ -436,120 +287,61 @@ class CassandraResultSet implements Resu
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Date getDate(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Date getDate(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Date getDate(int arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Date getDate(String arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public double getDouble(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public double getDouble(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public int getFetchDirection() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public int getFetchSize() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public float getFloat(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public float getFloat(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public int getHoldability() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param index
-     * @return
-     * @throws SQLException
-     */
     public int getInt(int index) throws SQLException
     {
         TypedColumn column = values.get(index - 1);
@@ -559,11 +351,6 @@ class CassandraResultSet implements Resu
         return value == null ? 0 : ((BigInteger) value).intValue();
     }
 
-    /**
-     * @param name
-     * @return
-     * @throws SQLException
-     */
     public int getInt(String name) throws SQLException
     {
         String nameAsString = decoder.colNameAsString(keyspace, columnFamily, name);
@@ -572,11 +359,6 @@ class CassandraResultSet implements Resu
         return value == null ? 0 : ((BigInteger) value).intValue();
     }
 
-    /**
-     * @param index
-     * @return
-     * @throws SQLException
-     */
     public long getLong(int index) throws SQLException
     {
         assert values != null;
@@ -600,80 +382,41 @@ class CassandraResultSet implements Resu
         return value == null ? 0 : (Long) value;
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public ResultSetMetaData getMetaData() throws SQLException
     {
         return meta;
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Reader getNCharacterStream(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Reader getNCharacterStream(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public NClob getNClob(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public NClob getNClob(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public String getNString(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public String getNString(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param index
-     * @return
-     * @throws SQLException
-     */
     public Object getObject(int index) throws SQLException
     {
         TypedColumn column = values.get(index - 1);
@@ -683,11 +426,6 @@ class CassandraResultSet implements Resu
         return value;
     }
 
-    /**
-     * @param name
-     * @return
-     * @throws SQLException
-     */
     public Object getObject(String name) throws SQLException
     {
         String nameAsString = decoder.colNameAsString(keyspace, columnFamily, name);
@@ -696,132 +434,67 @@ class CassandraResultSet implements Resu
         return value;
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Object getObject(int arg0, Map<String, Class<?>> arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Object getObject(String arg0, Map<String, Class<?>> arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Ref getRef(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Ref getRef(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public int getRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public RowId getRowId(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public RowId getRowId(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public SQLXML getSQLXML(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public SQLXML getSQLXML(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public short getShort(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public short getShort(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public Statement getStatement() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param index
-     * @return
-     * @throws SQLException
-     */
-    public String getString(int index) throws SQLException 
+    public String getString(int index) throws SQLException
     {
         TypedColumn column = values.get(index - 1);
         assert column != null;
@@ -830,11 +503,6 @@ class CassandraResultSet implements Resu
         return value == null ? null : ColumnDecoder.colValueAsString(value);
     }
 
-    /**
-     * @param name
-     * @return
-     * @throws SQLException
-     */
     public String getString(String name) throws SQLException
     {
         String nameAsString = this.decoder.colNameAsString(this.keyspace, this.columnFamily, name);
@@ -843,237 +511,133 @@ class CassandraResultSet implements Resu
         return value == null ? null : ColumnDecoder.colValueAsString(value);
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Time getTime(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Time getTime(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Time getTime(int arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Time getTime(String arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Timestamp getTimestamp(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public Timestamp getTimestamp(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @return
-     * @throws SQLException
-     */
     public Timestamp getTimestamp(String arg0, Calendar arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public int getType() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public URL getURL(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public URL getURL(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getUnicodeStream(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public InputStream getUnicodeStream(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public SQLWarning getWarnings() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void insertRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean isAfterLast() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean isBeforeFirst() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean isClosed() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean isFirst() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean isLast() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean last() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void moveToCurrentRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void moveToInsertRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
     
-    /**
-     * @param <T>
-     * @param iface
-     * @return
-     * @throws SQLException
-     */
     public <T> T unwrap(Class<T> iface) throws SQLException
     {
+        if (iface.equals(CassandraResultSet.class))
+            return (T) this;
         throw new SQLException("Unsupported unwrap interface: " + iface.getSimpleName());
     }
     
+    public boolean isWrapperFor(Class<?> iface) throws SQLException
+    {
+        return CassandraResultSet.class.isAssignableFrom(iface);
+    }
+
     /**
      * @return
      * @throws SQLException
@@ -1092,11 +656,10 @@ class CassandraResultSet implements Resu
             List<Column> cols = row.getColumns();
             for (Column col : cols)
             {
-                byte[] name = col.getName();
-                byte[] value = col.getValue();
-                TypedColumn c = decoder.makeCol(keyspace, columnFamily, name, value);
+
+                TypedColumn c = decoder.makeCol(keyspace, columnFamily, col);
                 values.add(c);
-                valueMap.put(decoder.colNameAsString(keyspace, columnFamily, name), c.getValue());
+                valueMap.put(decoder.colNameAsString(keyspace, columnFamily, col.getName()), c.getValue());
             }
             return !(values.isEmpty() && valueMap.isEmpty());
         } 
@@ -1106,241 +669,121 @@ class CassandraResultSet implements Resu
         }
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean previous() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void refreshRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @return
-     * @throws SQLException
-     */
     public boolean relative(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean rowDeleted() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean rowInserted() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean rowUpdated() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @throws SQLException
-     */
     public void setFetchDirection(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @throws SQLException
-     */
     public void setFetchSize(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateArray(int arg0, Array arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateArray(String arg0, Array arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateAsciiStream(int arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateAsciiStream(String arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateAsciiStream(int arg0, InputStream arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateAsciiStream(String arg0, InputStream arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateAsciiStream(int arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateAsciiStream(String arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBigDecimal(String arg0, BigDecimal arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBinaryStream(int arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBinaryStream(String arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBinaryStream(int arg0, InputStream arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBinaryStream(String arg0, InputStream arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBinaryStream(int arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBinaryStream(String arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
@@ -1356,864 +799,347 @@ class CassandraResultSet implements Resu
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBlob(String arg0, Blob arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBlob(int arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBlob(String arg0, InputStream arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBlob(int arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateBlob(String arg0, InputStream arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBoolean(int arg0, boolean arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBoolean(String arg0, boolean arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateByte(int arg0, byte arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateByte(String arg0, byte arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBytes(int arg0, byte[] arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateBytes(String arg0, byte[] arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateCharacterStream(int arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateCharacterStream(String arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateCharacterStream(int arg0, Reader arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateCharacterStream(String arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateClob(int arg0, Clob arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateClob(String arg0, Clob arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateClob(int arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateClob(String arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateClob(int arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateClob(String arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateDate(int arg0, Date arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateDate(String arg0, Date arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateDouble(int arg0, double arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateDouble(String arg0, double arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateFloat(int arg0, float arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateFloat(String arg0, float arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateInt(int arg0, int arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateInt(String arg0, int arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateLong(int arg0, long arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateLong(String arg0, long arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNCharacterStream(int arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNCharacterStream(String arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateNCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateNCharacterStream(String arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNClob(int arg0, NClob arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNClob(String arg0, NClob arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNClob(int arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNClob(String arg0, Reader arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateNClob(int arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateNClob(String arg0, Reader arg1, long arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNString(int arg0, String arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateNString(String arg0, String arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @throws SQLException
-     */
     public void updateNull(int arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @throws SQLException
-     */
     public void updateNull(String arg0) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateObject(int arg0, Object arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateObject(String arg0, Object arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateObject(int arg0, Object arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @param arg2
-     * @throws SQLException
-     */
     public void updateObject(String arg0, Object arg1, int arg2) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateRef(int arg0, Ref arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateRef(String arg0, Ref arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @throws SQLException
-     */
     public void updateRow() throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateRowId(int arg0, RowId arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateRowId(String arg0, RowId arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateShort(int arg0, short arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateShort(String arg0, short arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateString(int arg0, String arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateString(String arg0, String arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateTime(int arg0, Time arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateTime(String arg0, Time arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @param arg0
-     * @param arg1
-     * @throws SQLException
-     */
     public void updateTimestamp(String arg0, Timestamp arg1) throws SQLException
     {
         throw new UnsupportedOperationException("method not supported");
     }
 
-    /**
-     * @return
-     * @throws SQLException
-     */
     public boolean wasNull() throws SQLException
     {
         return wasNull;
     }
     
     /**
-     * RSMD implementation. Except where explicitly noted the metadata returned refers to the column 
-     * values, not the column names. There is an additional interface that describes column name 
-     * meta information.
+     * RSMD implementation.  The metadata returned refers to the column
+     * values, not the column names.
      */
-    private class RsMetaData implements CassandraResultSetMetaData, ResultSetMetaData
+    class CResultSetMetaData implements ResultSetMetaData
     {
-        public byte[] getKey()
-        {
-            return curRowKey;
-        }
-
-        public boolean isNameCaseSensitive(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            if (nameType instanceof ColumnMetaData)
-                return ((ColumnMetaData)nameType).isCaseSensitive();
-            else 
-                return nameType.getType().equals(String.class);
-        }
-        
-        public boolean isValueCaseSensitive(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            TypedColumn tc = values.get(column);
-            if (tc.getValidator() instanceof ColumnMetaData)
-                return ((ColumnMetaData)tc.getValidator()).isCaseSensitive();
-            else 
-                return tc.getValidator().getType().equals(String.class);
-        }
-
-        public boolean isNameCurrency(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            if (nameType instanceof ColumnMetaData)
-                return ((ColumnMetaData)nameType).isCurrency();
-            else
-                return false;
-        }
-        
-        public boolean isValueCurrency(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            TypedColumn tc = values.get(column);
-            if (tc.getValidator() instanceof ColumnMetaData)
-                return ((ColumnMetaData)tc.getValidator()).isCurrency();
-            else
-                return false;
-        }
-
-        public boolean isNameSigned(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return Utils.isTypeSigned(nameType);
-        }
-        
-        public boolean isValueSigned(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            TypedColumn tc = values.get(column);
-            return Utils.isTypeSigned(tc.getValidator());
-        }
-
-        public int getNameDisplaySize(int column) throws SQLException
-        {
-            return getColumnName(column).length();
-        }
-
-        public int getValueDisplaySize(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return values.get(column).getValueString().length();
-        }
-
-        public int getNamePrecision(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            TypedColumn col = values.get(column);
-            if (nameType instanceof ColumnMetaData)
-                return ((ColumnMetaData)nameType).getPrecision();
-            else if (nameType.getType().equals(String.class))
-                return col.getNameString().length();
-            else if (nameType == BytesType.instance)
-                return col.getNameString().length();
-            else if (nameType.getType().equals(UUID.class))
-                return 36; // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-            else if (nameType == LongType.instance)
-                return 19; // number of digits in 2**63-1.
-            else 
-                return 0;
-        }
-        
-        public int getValuePrecision(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            TypedColumn col = values.get(column);
-            if (col.getValidator() instanceof ColumnMetaData)
-                return ((ColumnMetaData)col.getValidator()).getPrecision();
-            else if (col.getValidator().getType().equals(String.class))
-                return col.getValueString().length();
-            else if (col.getValidator() == BytesType.instance)
-                return col.getValueString().length();
-            else if (col.getValidator().getType().equals(UUID.class))
-                return 36; // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-            else if (col.getValidator() == LongType.instance)
-                return 19; // number of digits in 2**63-1.
-            else 
-                return 0;
-        }
-
-        public int getNameScale(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return Utils.getTypeScale(nameType);
-        }
-        
-        public int getValueScale(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return Utils.getTypeScale(values.get(column).getValidator());
-        }
-
-        public int getNameType(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return Utils.getJdbcType(nameType);
-        }
-        
-        public int getValueType(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return Utils.getJdbcType(values.get(column).getValidator());
-        }
-        
-        public String getNameTypeName(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return nameType.getClass().getSimpleName();
-        }
-        
-        public String getValueTypeName(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return values.get(column).getValidator().getClass().getSimpleName();
-        }
-
-        public String getNameClassName(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return nameType.getType().getName();
-        }
-
-        public String getValueClassName(int column) throws SQLException
-        {
-            column--;
-            checkIndex(column);
-            return values.get(column).getValidator().getType().getName();
-        }
-        
-        //
-        // ResultSetMetaData
-        //
-        
         private void checkIndex(int i) throws SQLException
         {
             if (i >= values.size())
@@ -2229,12 +1155,18 @@ class CassandraResultSet implements Resu
         {
             column--;
             checkIndex(column);
-            return values.get(column).getValidator() instanceof CounterColumnType; // todo: check Value is correct.
+            return values.get(column).getValueType() instanceof CounterColumnType; // todo: check Value is correct.
         }
 
         public boolean isCaseSensitive(int column) throws SQLException
         {
-            return isValueCaseSensitive(column);
+            column--;
+            checkIndex(column);
+            TypedColumn tc = values.get(column);
+            if (tc.getValueType() instanceof ColumnMetaData)
+                return ((ColumnMetaData)tc.getValueType()).isCaseSensitive();
+            else
+                return tc.getValueType().getType().equals(String.class);
         }
 
         public boolean isSearchable(int column) throws SQLException
@@ -2244,7 +1176,13 @@ class CassandraResultSet implements Resu
 
         public boolean isCurrency(int column) throws SQLException
         {
-            return isValueCurrency(column);
+            column--;
+            checkIndex(column);
+            TypedColumn tc = values.get(column);
+            if (tc.getValueType() instanceof ColumnMetaData)
+                return ((ColumnMetaData)tc.getValueType()).isCurrency();
+            else
+                return false;
         }
 
         public int isNullable(int column) throws SQLException
@@ -2255,12 +1193,17 @@ class CassandraResultSet implements Resu
 
         public boolean isSigned(int column) throws SQLException
         {
-            return isValueSigned(column);
+            column--;
+            checkIndex(column);
+            TypedColumn tc = values.get(column);
+            return Utils.isTypeSigned(tc.getValueType());
         }
 
         public int getColumnDisplaySize(int column) throws SQLException
         {
-            return getValueDisplaySize(column);
+            column--;
+            checkIndex(column);
+            return values.get(column).getValueString().length();
         }
 
         public String getColumnLabel(int column) throws SQLException
@@ -2282,12 +1225,28 @@ class CassandraResultSet implements Resu
 
         public int getPrecision(int column) throws SQLException
         {
-            return getValuePrecision(column);
+            column--;
+            checkIndex(column);
+            TypedColumn col = values.get(column);
+            if (col.getValueType() instanceof ColumnMetaData)
+                return ((ColumnMetaData)col.getValueType()).getPrecision();
+            else if (col.getValueType().getType().equals(String.class))
+                return col.getValueString().length();
+            else if (col.getValueType() == BytesType.instance)
+                return col.getValueString().length();
+            else if (col.getValueType().getType().equals(UUID.class))
+                return 36; // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+            else if (col.getValueType() == LongType.instance)
+                return 19; // number of digits in 2**63-1.
+            else
+                return 0;
         }
 
         public int getScale(int column) throws SQLException
         {
-            return getValueScale(column);
+            column--;
+            checkIndex(column);
+            return Utils.getTypeScale(values.get(column).getValueType());
         }
 
         public String getTableName(int column) throws SQLException
@@ -2302,13 +1261,17 @@ class CassandraResultSet implements Resu
 
         public int getColumnType(int column) throws SQLException
         {
-            return getValueType(column);
+            column--;
+            checkIndex(column);
+            return Utils.getJdbcType(values.get(column).getValueType());
         }
 
         // todo: spec says "database specific type name". this means the abstract type.
         public String getColumnTypeName(int column) throws SQLException
         {
-            return getValueTypeName(column);
+            column--;
+            checkIndex(column);
+            return values.get(column).getValueType().getClass().getSimpleName();
         }
 
         public boolean isReadOnly(int column) throws SQLException
@@ -2328,21 +1291,19 @@ class CassandraResultSet implements Resu
 
         public String getColumnClassName(int column) throws SQLException
         {
-            return getValueClassName(column);
+            column--;
+            checkIndex(column);
+            return values.get(column).getValueType().getType().getName();
         }
 
-        // todo: once the kinks are worked out, allow unwrapping as CassandraResultSetMetaData.
         public <T> T unwrap(Class<T> iface) throws SQLException
         {
-            if (iface.equals(CassandraResultSetMetaData.class))
-                return (T)this;
-            else
-                throw new SQLFeatureNotSupportedException("No wrappers");
+            throw new SQLException("No wrapping implemented");
         }
 
         public boolean isWrapperFor(Class<?> iface) throws SQLException
         {
-            return CassandraResultSetMetaData.class.isAssignableFrom(iface);
+            return false;
         }
     }
 }

Added: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java?rev=1100827&view=auto
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java (added)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraResultSet.java Sun May  8 22:32:47 2011
@@ -0,0 +1,21 @@
+package org.apache.cassandra.cql.jdbc;
+
+import java.sql.ResultSet;
+
+public interface CassandraResultSet extends ResultSet
+{
+    /**
+     * @return the current row key
+     */
+    public byte[] getKey();
+
+    /**
+     * @return the raw column data for the given column offset
+     */
+    public TypedColumn getColumn(int i);
+
+    /**
+     * @return the raw column data for the given column name
+     */
+    public TypedColumn getColumn(String name);
+}

Modified: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraStatement.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraStatement.java?rev=1100827&r1=1100826&r2=1100827&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraStatement.java (original)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraStatement.java Sun May  8 22:32:47 2011
@@ -235,7 +235,7 @@ class CassandraStatement implements Stat
         {
             CqlResult rSet = connection.execute(query);
             // todo: encapsulate.
-            return new CassandraResultSet(rSet, connection.decoder, connection.curKeyspace, connection.curColumnFamily);
+            return new CResultSet(rSet, connection.decoder, connection.curKeyspace, connection.curColumnFamily);
         }
         catch (InvalidRequestException e)
         {

Modified: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java?rev=1100827&r1=1100826&r2=1100827&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java (original)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java Sun May  8 22:32:47 2011
@@ -24,6 +24,7 @@ package org.apache.cassandra.cql.jdbc;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.thrift.CfDef;
+import org.apache.cassandra.thrift.Column;
 import org.apache.cassandra.thrift.ColumnDef;
 import org.apache.cassandra.thrift.KsDef;
 import org.apache.cassandra.utils.ByteBufferUtil;
@@ -41,7 +42,7 @@ class ColumnDecoder 
 {
     private static final Logger logger = LoggerFactory.getLogger(ColumnDecoder.class);
     private static final String MapFormatString = "%s.%s.%s.%s";
-    
+
     // basically denotes column or value.
     enum Specifier
     {
@@ -183,13 +184,13 @@ class ColumnDecoder 
         else
             return value == null ? null : value.toString();
     }
-    
+
     /** constructs a typed column */
-    public TypedColumn makeCol(String keyspace, String columnFamily, byte[] name, byte[] value)
+    public TypedColumn makeCol(String keyspace, String columnFamily, Column column)
     {
         CfDef cfDef = cfDefs.get(String.format("%s.%s", keyspace, columnFamily));
         AbstractType comparator = getComparator(keyspace, columnFamily, Specifier.Comparator, cfDef);
-        AbstractType validator = getComparator(keyspace, columnFamily, name, Specifier.ColumnSpecific, null);
-        return new TypedColumn(comparator, name, validator, value);
+        AbstractType validator = getComparator(keyspace, columnFamily, column.getName(), Specifier.ColumnSpecific, null);
+        return new TypedColumn(column, comparator, validator);
     }
 }

Modified: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/TypedColumn.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/TypedColumn.java?rev=1100827&r1=1100826&r2=1100827&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/TypedColumn.java (original)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/TypedColumn.java Sun May  8 22:32:47 2011
@@ -22,37 +22,36 @@ package org.apache.cassandra.cql.jdbc;
 
 
 import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.thrift.Column;
 
 import java.nio.ByteBuffer;
 
-class TypedColumn<N, V>
+class TypedColumn
 {
-    private final N name;
-    private final V value;
-    
-    // we cache the string versions of the byte buffers here.  It turns out that {N|V}.toString() isn't always the same
-    // (a good example is byte buffers) as the stringified versions supplied by the AbstractTypes.
+    private final Column rawColumn;
+
+    // we cache the frequently-accessed forms: java object for value, String for name.
+    // Note that {N|V}.toString() isn't always the same as Type.getString
+    // (a good example is byte buffers).
+    private final Object value;
     private final String nameString;
-    private final String valueString;
-    private final AbstractType<V> validator;
-    
-    public TypedColumn(AbstractType<N> comparator, byte[] name, AbstractType<V> validator, byte[] value)
+    private final AbstractType nameType, valueType;
+
+    public TypedColumn(Column column, AbstractType comparator, AbstractType validator)
     {
-        ByteBuffer bbName = ByteBuffer.wrap(name);
-        ByteBuffer bbValue = value == null ? null : ByteBuffer.wrap(value);
-        this.name = comparator.compose(bbName);
-        this.value = value == null ? null : validator.compose(bbValue);
-        nameString = comparator.getString(bbName);
-        valueString = value == null ? null : validator.getString(bbValue);
-        this.validator = validator;
+        rawColumn = column;
+        this.value = column.value == null ? null : validator.compose(column.value);
+        nameString = comparator.getString(column.name);
+        nameType = comparator;
+        valueType = validator;
     }
-    
-    public N getName()
+
+    public Column getRawColumn()
     {
-        return name;
+        return rawColumn;
     }
     
-    public V getValue()
+    public Object getValue()
     {
         return value;
     }
@@ -64,11 +63,16 @@ class TypedColumn<N, V>
     
     public String getValueString()
     {
-        return valueString;
+        return valueType.getString(rawColumn.value);
     }
     
-    public AbstractType<V> getValidator()
+    public AbstractType getNameType()
+    {
+        return nameType;
+    }
+
+    public AbstractType getValueType()
     {
-        return validator;
+        return valueType;
     }
 }

Modified: cassandra/branches/cassandra-0.8/drivers/java/test/org/apache/cassandra/cql/JdbcDriverTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/test/org/apache/cassandra/cql/JdbcDriverTest.java?rev=1100827&r1=1100826&r2=1100827&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/test/org/apache/cassandra/cql/JdbcDriverTest.java (original)
+++ cassandra/branches/cassandra-0.8/drivers/java/test/org/apache/cassandra/cql/JdbcDriverTest.java Sun May  8 22:32:47 2011
@@ -25,27 +25,18 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
+import java.sql.*;
 import java.util.Arrays;
 
-import org.apache.cassandra.cql.jdbc.CassandraResultSetMetaData;
-import org.apache.cassandra.db.marshal.AsciiType;
-import org.apache.cassandra.db.marshal.BytesType;
-import org.apache.cassandra.db.marshal.IntegerType;
-import org.apache.cassandra.db.marshal.LongType;
-import org.apache.cassandra.db.marshal.UTF8Type;
-import org.apache.cassandra.utils.FBUtilities;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import org.apache.cassandra.db.marshal.*;
+import org.apache.cassandra.utils.FBUtilities;
+
+import static junit.framework.Assert.assertEquals;
+
 /**
  * Test case for unit test of various methods of JDBC implementation.
  */
@@ -102,21 +93,14 @@ public class JdbcDriverTest extends Embe
         assert md.isCaseSensitive(col) == caseSensitive;
     }
     
-    private static void expectedMetaData(CassandraResultSetMetaData md, int col,
-                                         String nameClass, int nameType, String nameTypeName, boolean nameSigned, boolean nameCaseSense,
+    private static void expectedMetaData(ResultSetMetaData md, int col,
                                          String valuClass, int valuType, String valuTypeName, boolean valuSigned, boolean valuCaseSense) throws SQLException
     {
-        assert nameClass.equals(md.getNameClassName(col));
-        assert nameType == md.getNameType(col);
-        assert nameTypeName.equals(md.getNameTypeName(col));
-        assert nameSigned == md.isNameSigned(col);
-        assert nameCaseSense == md.isNameCaseSensitive(col);
-        
-        assert valuClass.equals(md.getValueClassName(col));
-        assert valuType == md.getValueType(col);
-        assert valuTypeName.equals(md.getValueTypeName(col));
-        assert valuSigned == md.isValueSigned(col);
-        assert valuCaseSense == md.isValueCaseSensitive(col);
+        assertEquals(valuClass, md.getColumnClassName(col));
+        assertEquals(valuType, md.getColumnType(col));
+        assertEquals(valuTypeName, md.getColumnTypeName(col));
+        assertEquals(valuSigned, md.isSigned(col));
+        assertEquals(valuCaseSense, md.isCaseSensitive(col));
     }
     
     @Test
@@ -166,12 +150,14 @@ public class JdbcDriverTest extends Embe
         expectedMetaData(md, 1, BigInteger.class.getName(), "JdbcInteger", "Keyspace1", "1", Types.BIGINT, IntegerType.class.getSimpleName(), true, false);
         expectedMetaData(md, 2, BigInteger.class.getName(), "JdbcInteger", "Keyspace1", "2", Types.BIGINT, IntegerType.class.getSimpleName(), true, false);
 
-        CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class);
         for (int i = 0; i < md.getColumnCount(); i++)
-            expectedMetaData(
-                    cmd, i+1, 
-                    BigInteger.class.getName(), Types.BIGINT, IntegerType.class.getSimpleName(), true, false,
-                    BigInteger.class.getName(), Types.BIGINT, IntegerType.class.getSimpleName(), true, false);
+            expectedMetaData(md,
+                             i + 1,
+                             BigInteger.class.getName(),
+                             Types.BIGINT,
+                             IntegerType.class.getSimpleName(),
+                             true,
+                             false);
         
     }
     
@@ -191,12 +177,14 @@ public class JdbcDriverTest extends Embe
         expectedMetaData(md, 1, Long.class.getName(), "JdbcLong", "Keyspace1", "1", Types.BIGINT, LongType.class.getSimpleName(), true, false);
         expectedMetaData(md, 2, Long.class.getName(), "JdbcLong", "Keyspace1", "2", Types.BIGINT, LongType.class.getSimpleName(), true, false);
         
-        CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class);
         for (int i = 0; i < md.getColumnCount(); i++)
-            expectedMetaData(
-                    cmd, i+1,
-                    Long.class.getName(), Types.BIGINT, LongType.class.getSimpleName(), true, false,
-                    Long.class.getName(), Types.BIGINT, LongType.class.getSimpleName(), true, false);
+            expectedMetaData(md,
+                             i + 1,
+                             Long.class.getName(),
+                             Types.BIGINT,
+                             LongType.class.getSimpleName(),
+                             true,
+                             false);
     }
     
     @Test
@@ -224,18 +212,24 @@ public class JdbcDriverTest extends Embe
         assert md.getColumnCount() == 2;
         expectedMetaData(md, 1, String.class.getName(), "JdbcUtf8", "Keyspace1", "a", Types.VARCHAR, UTF8Type.class.getSimpleName(), false, true);
         expectedMetaData(md, 2, String.class.getName(), "JdbcUtf8", "Keyspace1", "b", Types.VARCHAR, UTF8Type.class.getSimpleName(), false, true);
-        
-        CassandraResultSetMetaData cmd0 = rs0.getMetaData().unwrap(CassandraResultSetMetaData.class);
-        CassandraResultSetMetaData cmd1 = rs1.getMetaData().unwrap(CassandraResultSetMetaData.class);
+
         for (int i = 0; i < 2; i++)
         {
-            expectedMetaData(cmd0, i+1,
-                    String.class.getName(), Types.VARCHAR, AsciiType.class.getSimpleName(), false, true,
-                    String.class.getName(), Types.VARCHAR, AsciiType.class.getSimpleName(), false, true);
-            expectedMetaData(cmd1, i+1,
-                    String.class.getName(), Types.VARCHAR, UTF8Type.class.getSimpleName(), false, true,
-                    String.class.getName(), Types.VARCHAR, UTF8Type.class.getSimpleName(), false, true);
-            
+            expectedMetaData(rs0.getMetaData(),
+                             i + 1,
+                             String.class.getName(),
+                             Types.VARCHAR,
+                             AsciiType.class.getSimpleName(),
+                             false,
+                             true);
+            expectedMetaData(rs1.getMetaData(),
+                             i + 1,
+                             String.class.getName(),
+                             Types.VARCHAR,
+                             UTF8Type.class.getSimpleName(),
+                             false,
+                             true);
+
         }
     }
     
@@ -268,11 +262,14 @@ public class JdbcDriverTest extends Embe
         expectedMetaData(md, 1, ByteBuffer.class.getName(), "JdbcBytes", "Keyspace1", FBUtilities.bytesToHex(a), Types.BINARY, BytesType.class.getSimpleName(), false, false);
         expectedMetaData(md, 2, ByteBuffer.class.getName(), "JdbcBytes", "Keyspace1", FBUtilities.bytesToHex(b), Types.BINARY, BytesType.class.getSimpleName(), false, false);
         
-        CassandraResultSetMetaData cmd = md.unwrap(CassandraResultSetMetaData.class);
         for (int i = 0; i < md.getColumnCount(); i++)
-            expectedMetaData(cmd, i+1,
-                    ByteBuffer.class.getName(), Types.BINARY, BytesType.class.getSimpleName(), false, false,
-                    ByteBuffer.class.getName(), Types.BINARY, BytesType.class.getSimpleName(), false, false);
+            expectedMetaData(md,
+                             i + 1,
+                             ByteBuffer.class.getName(),
+                             Types.BINARY,
+                             BytesType.class.getSimpleName(),
+                             false,
+                             false);
     }
     
     @Test



Mime
View raw message