[2/2] git commit: cqlsh: fix problem describing pre-cql3 CFs that are case-sensitive Patch by paul cannon reviewed by brandonwilliams for CASSANDRA-4385
cqlsh: fix problem describing pre-cql3 CFs that are case-sensitive Patch by paul cannon reviewed by brandonwilliams for CASSANDRA-4385 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/10372c20 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/10372c20 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/10372c20 Branch: refs/heads/trunk Commit: 10372c20dfe5af0dc0ab7ed77370cd785c78e82e Parents: bb37a0f Author: Brandon Williams Authored: Thu Jul 26 12:38:10 2012 -0500 Committer: Brandon Williams Committed: Thu Jul 26 12:38:10 2012 -0500 -- bin/cqlsh |9 - 1 files changed, 8 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/10372c20/bin/cqlsh -- diff --git a/bin/cqlsh b/bin/cqlsh index c67a818..c4b35fc 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -329,6 +329,9 @@ class NoKeyspaceError(Exception): class KeyspaceNotFound(Exception): pass +class ColumnFamilyNotFound(Exception): +pass + class VersionNotSupported(Exception): pass @@ -678,6 +681,8 @@ class Shell(cmd.Cmd): def fetchdict(self): row = self.cursor.fetchone() +if row is None: +return None desc = self.cursor.description return dict(zip([d[0] for d in desc], row)) @@ -705,7 +710,7 @@ class Shell(cmd.Cmd): for c in cf_defs: if c.name == cfname: return c -raise KeyError("Unconfigured column family %r" % (cfname,)) +raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,)) def get_columnfamily_names(self, ksname=None): return [c.name for c in self.get_columnfamilies(ksname)] @@ -800,6 +805,8 @@ class Shell(cmd.Cmd): where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname}) layout = self.fetchdict() +if layout is None: +raise ColumnFamilyNotFound("Column family %r not found" % cfname) self.cursor.execute("""select * from system.schema_columns where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname})
git commit: cqlsh: fix problem describing pre-cql3 CFs that are case-sensitive Patch by paul cannon reviewed by brandonwilliams for CASSANDRA-4385
Updated Branches: refs/heads/cassandra-1.1 bb37a0f25 -> 10372c20d cqlsh: fix problem describing pre-cql3 CFs that are case-sensitive Patch by paul cannon reviewed by brandonwilliams for CASSANDRA-4385 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/10372c20 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/10372c20 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/10372c20 Branch: refs/heads/cassandra-1.1 Commit: 10372c20dfe5af0dc0ab7ed77370cd785c78e82e Parents: bb37a0f Author: Brandon Williams Authored: Thu Jul 26 12:38:10 2012 -0500 Committer: Brandon Williams Committed: Thu Jul 26 12:38:10 2012 -0500 -- bin/cqlsh |9 - 1 files changed, 8 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/10372c20/bin/cqlsh -- diff --git a/bin/cqlsh b/bin/cqlsh index c67a818..c4b35fc 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -329,6 +329,9 @@ class NoKeyspaceError(Exception): class KeyspaceNotFound(Exception): pass +class ColumnFamilyNotFound(Exception): +pass + class VersionNotSupported(Exception): pass @@ -678,6 +681,8 @@ class Shell(cmd.Cmd): def fetchdict(self): row = self.cursor.fetchone() +if row is None: +return None desc = self.cursor.description return dict(zip([d[0] for d in desc], row)) @@ -705,7 +710,7 @@ class Shell(cmd.Cmd): for c in cf_defs: if c.name == cfname: return c -raise KeyError("Unconfigured column family %r" % (cfname,)) +raise ColumnFamilyNotFound("Unconfigured column family %r" % (cfname,)) def get_columnfamily_names(self, ksname=None): return [c.name for c in self.get_columnfamilies(ksname)] @@ -800,6 +805,8 @@ class Shell(cmd.Cmd): where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname}) layout = self.fetchdict() +if layout is None: +raise ColumnFamilyNotFound("Column family %r not found" % cfname) self.cursor.execute("""select * from system.schema_columns where "keyspace"=:ks and "columnfamily"=:cf""", {'ks': ksname, 'cf': cfname})