cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [3/3] git commit: cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables (2.0)
Date Tue, 21 May 2013 23:53:34 GMT
cqlsh: ninja-fix DROP INDEX autocompletion for CQL3 tables (2.0)


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

Branch: refs/heads/trunk
Commit: f3d2a52b99b789586363a5966a766629710bcb40
Parents: b53d3c4
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Wed May 22 02:53:18 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Wed May 22 02:53:18 2013 +0300

----------------------------------------------------------------------
 bin/cqlsh |   31 ++++++-------------------------
 1 files changed, 6 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3d2a52b/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index c7ac533..4a4fced 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -564,22 +564,6 @@ class Shell(cmd.Cmd):
     def get_keyspace_names(self):
         return [k.name for k in self.get_keyspaces()]
 
-    def get_columnfamilies(self, ksname=None):
-        if ksname is None:
-            ksname = self.current_keyspace
-            if ksname is None:
-                raise NoKeyspaceError("Not in any keyspace.")
-        return self.get_keyspace(ksname).cf_defs
-
-    def get_columnfamily(self, cfname, ksname=None):
-        if ksname is None:
-            ksname = self.current_keyspace
-        cf_defs = self.get_columnfamilies(ksname)
-        for c in cf_defs:
-            if c.name == cfname:
-                return c
-        raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,))
-
     def get_columnfamily_names(self, ksname=None):
         if ksname is None:
             ksname = self.current_keyspace
@@ -590,16 +574,13 @@ class Shell(cmd.Cmd):
                             consistency_level='ONE')
         return [str(row[0]) for row in self.cursor.fetchall()]
 
-    # TODO: FIXME
     def get_index_names(self, ksname=None):
-        cols = []
-        if self.cqlver_atleast(3) and not self.is_cql3_beta():
-            for cfname in self.get_columnfamily_names_cql3(ksname=ksname):
-                cols.extend(self.get_columnfamily_layout(ksname, cfname).columns)
-        else:
-            for cf in self.get_columnfamilies(ksname):
-                cols.extend(cf.column_metadata)
-        return [col.index_name for col in cols if col.index_name is not None]
+        idxnames = []
+        for cfname in self.get_columnfamily_names(ksname=ksname):
+            for col in self.get_columnfamily_layout(ksname, cfname).columns:
+                if col.index_name is not None:
+                    idxnames.append(col.index_name)
+        return idxnames
 
     def get_column_names(self, ksname, cfname):
         if ksname is None:


Mime
View raw message