cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1166301 - in /cassandra/trunk/drivers/java: ./ src/org/apache/cassandra/cql/jdbc/
Date Wed, 07 Sep 2011 18:26:19 GMT
Author: jbellis
Date: Wed Sep  7 18:26:19 2011
New Revision: 1166301

URL: http://svn.apache.org/viewvc?rev=1166301&view=rev
Log:
add getRowId support to CResultSet
patch by Rick Shaw; reviewed by jbellis for CASSANDRA-3089

Modified:
    cassandra/trunk/drivers/java/CHANGES.txt
    cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java
    cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
    cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraDatabaseMetaData.java
    cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraPreparedStatement.java

Modified: cassandra/trunk/drivers/java/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/java/CHANGES.txt?rev=1166301&r1=1166300&r2=1166301&view=diff
==============================================================================
--- cassandra/trunk/drivers/java/CHANGES.txt (original)
+++ cassandra/trunk/drivers/java/CHANGES.txt Wed Sep  7 18:26:19 2011
@@ -1,4 +1,4 @@
 1.0.4
- * improve JDBC spec compliance (CASSANDRA-2720, 2754, 3052)
+ * improve JDBC spec compliance (CASSANDRA-2720, 2754, 3052, 3089)
  * cooperate with other jdbc drivers (CASSANDRA-2842)
  * fix unbox-to-NPE with null primitives (CASSANDRA-2956)

Modified: cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java?rev=1166301&r1=1166300&r2=1166301&view=diff
==============================================================================
--- cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java
(original)
+++ cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/AbstractResultSet.java
Wed Sep  7 18:26:19 2011
@@ -155,10 +155,6 @@ abstract class AbstractResultSet
         throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
     }
 
-    public RowId getRowId(int arg0) throws SQLException
-    {
-        throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
-    }
 
     public SQLXML getSQLXML(int arg0) throws SQLException
     {

Modified: cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java?rev=1166301&r1=1166300&r2=1166301&view=diff
==============================================================================
--- cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java (original)
+++ cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java Wed Sep
 7 18:26:19 2011
@@ -592,10 +592,24 @@ class CResultSet extends AbstractResultS
         return rowNumber;
     }
 
-    // RowId (shall we just store the raw bytes as it is kept in C* ? Probably...
-    public RowId getRowId(String arg0) throws SQLException
+    public RowId getRowId(int index) throws SQLException
     {
-        throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
+        checkIndex(index);
+        return getRowId(values.get(index - 1));
+    }
+
+    public RowId getRowId(String name) throws SQLException
+    {
+        checkName(name);
+        return getRowId(valueMap.get(name));
+    }
+
+    private final RowId getRowId(TypedColumn column) throws SQLException
+    {
+        checkNotClosed();
+        ByteBuffer value =  column.getRawColumn().value;
+        wasNull = value == null;
+        return value == null ? null : new CassandraRowId(value);
     }
 
     public short getShort(int index) throws SQLException

Modified: cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraDatabaseMetaData.java?rev=1166301&r1=1166300&r2=1166301&view=diff
==============================================================================
--- cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraDatabaseMetaData.java
(original)
+++ cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraDatabaseMetaData.java
Wed Sep  7 18:26:19 2011
@@ -29,9 +29,6 @@ import java.sql.RowIdLifetime;
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 
-import org.apache.cassandra.db.DBConstants;
-import org.apache.cassandra.utils.FBUtilities;
-
 class CassandraDatabaseMetaData implements DatabaseMetaData
 {
     private CassandraConnection connection;
@@ -360,7 +357,7 @@ class CassandraDatabaseMetaData implemen
 
     public RowIdLifetime getRowIdLifetime() throws SQLException
     {
-        return RowIdLifetime.ROWID_UNSUPPORTED;
+        return RowIdLifetime.ROWID_VALID_FOREVER;
     }
 
     public String getSQLKeywords() throws SQLException

Modified: cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraPreparedStatement.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraPreparedStatement.java?rev=1166301&r1=1166300&r2=1166301&view=diff
==============================================================================
--- cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraPreparedStatement.java
(original)
+++ cassandra/trunk/drivers/java/src/org/apache/cassandra/cql/jdbc/CassandraPreparedStatement.java
Wed Sep  7 18:26:19 2011
@@ -311,6 +311,11 @@ class CassandraPreparedStatement extends
         variables.put(parameterIndex, x);
     }
 
+    public void setRowId(int parameterIndex, RowId rowid) throws SQLException
+    {
+        setObject(parameterIndex, ByteBuffer.wrap(rowid.getBytes()));
+    }
+
     public void setShort(int parameterIndex, short x) throws SQLException
     {
         setInt(parameterIndex, x);
@@ -490,11 +495,6 @@ class CassandraPreparedStatement extends
         throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
     }
 
-    public void setRowId(int parameterIndex, RowId x) throws SQLException
-    {
-        throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);
-    }
-
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
     {
         throw new SQLFeatureNotSupportedException(NOT_SUPPORTED);



Mime
View raw message