cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1101662 - /cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
Date Tue, 10 May 2011 21:55:04 GMT
Author: jbellis
Date: Tue May 10 21:55:04 2011
New Revision: 1101662

URL: http://svn.apache.org/viewvc?rev=1101662&view=rev
Log:
fix jdbc getInt w/ null columns

Modified:
    cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java

Modified: cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java?rev=1101662&r1=1101661&r2=1101662&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
(original)
+++ cassandra/branches/cassandra-0.8/drivers/java/src/org/apache/cassandra/cql/jdbc/CResultSet.java
Tue May 10 21:55:04 2011
@@ -182,11 +182,21 @@ public class CResultSet extends Abstract
     {
         // bit of a hack, this, but asking for getInt seems so common that we should accomodate
it
         if (column.getValue() instanceof BigInteger)
+        {
+            wasNull = false;
             return getBigInteger(column).intValue();
+        }
         else if (column.getValue() instanceof Long)
+        {
+            wasNull = false;
             return getLong(column).intValue();
-        else
-            throw new SQLException("Non-integer value " + column.getValue());
+        }
+        else if (column.getValue() == null)
+        {
+            wasNull = true;
+            return 0;
+        }
+        throw new SQLException("Non-integer value " + column.getValue());
     }
 
     public int getInt(int index) throws SQLException



Mime
View raw message