cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [09/12] git commit: enhance UntypedResultSet patch by Ben Coverston; reviewed by jbellis for CASSANDRA-6000
Date Thu, 12 Sep 2013 11:41:23 GMT
enhance UntypedResultSet
patch by Ben Coverston; reviewed by jbellis for CASSANDRA-6000


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/394b35ed
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/394b35ed
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/394b35ed

Branch: refs/heads/cassandra-2.0
Commit: 394b35edf3e6fa4d83386622b438a8ca684385ad
Parents: 8cc28a1
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Sep 12 13:40:40 2013 +0200
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Sep 12 13:40:40 2013 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/UntypedResultSet.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/394b35ed/src/java/org/apache/cassandra/cql3/UntypedResultSet.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/UntypedResultSet.java b/src/java/org/apache/cassandra/cql3/UntypedResultSet.java
index 9bee563..b77e727 100644
--- a/src/java/org/apache/cassandra/cql3/UntypedResultSet.java
+++ b/src/java/org/apache/cassandra/cql3/UntypedResultSet.java
@@ -77,10 +77,12 @@ public class UntypedResultSet implements Iterable<UntypedResultSet.Row>
 
     public static class Row
     {
-        Map<String, ByteBuffer> data = new HashMap<String, ByteBuffer>();
+        final Map<String, ByteBuffer> data = new HashMap<String, ByteBuffer>();
+        final List<ColumnSpecification> columns;
 
         public Row(List<ColumnSpecification> names, List<ByteBuffer> columns)
         {
+            this.columns = names;
             for (int i = 0; i < names.size(); i++)
                 data.put(names.get(i).toString(), columns.get(i));
         }
@@ -142,12 +144,23 @@ public class UntypedResultSet implements Iterable<UntypedResultSet.Row>
             return raw == null ? null : SetType.getInstance(type).compose(raw);
         }
 
+        public <T> List<T> getList(String column, AbstractType<T> type)
+        {
+            ByteBuffer raw = data.get(column);
+            return raw == null ? null : ListType.getInstance(type).compose(raw);
+        }
+
         public <K, V> Map<K, V> getMap(String column, AbstractType<K> keyType,
AbstractType<V> valueType)
         {
             ByteBuffer raw = data.get(column);
             return raw == null ? null : MapType.getInstance(keyType, valueType).compose(raw);
         }
 
+        public List<ColumnSpecification> getColumns()
+        {
+            return columns;
+        }
+
         @Override
         public String toString()
         {


Mime
View raw message