Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f27cc7ef Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f27cc7ef Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f27cc7ef Branch: refs/heads/cassandra-3.0 Commit: f27cc7ef3cd8448b6e29b3c8e6b5ae08050e6e2f Parents: df7c658 0fbf715 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Fri Oct 30 14:52:53 2015 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Fri Oct 30 14:52:53 2015 +0100 ---------------------------------------------------------------------- bin/cqlsh.py | 69 ++++++++++--------- lib/cassandra-driver-internal-only-2.7.2.zip | Bin 0 -> 229600 bytes ...iver-internal-only-3.0.0a2.post0-95c6008.zip | Bin 233564 -> 0 bytes 3 files changed, 38 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f27cc7ef/bin/cqlsh.py ---------------------------------------------------------------------- diff --cc bin/cqlsh.py index 725f6e9,09da020..e092d44 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1180,24 -1159,9 +1181,24 @@@ class Shell(cmd.Cmd) except Exception, err: self.printerr("Unable to fetch query trace: %s" % (str(err),)) - return success + return result - def parse_for_table_meta(self, query_string): + def parse_for_select_meta(self, query_string): + try: + parsed = cqlruleset.cql_parse(query_string)[1] + except IndexError: + return None + ks = self.cql_unprotect_name(parsed.get_binding('ksname', None)) + name = self.cql_unprotect_name(parsed.get_binding('cfname', None)) + try: + return self.get_table_meta(ks, name) + except ColumnFamilyNotFound: + try: + return self.get_view_meta(ks, name) + except MaterializedViewNotFound: + raise ObjectNotFound("%r not found in keyspace %r" % (name, ks)) + + def parse_for_update_meta(self, query_string): try: parsed = cqlruleset.cql_parse(query_string)[1] except IndexError: @@@ -1228,15 -1192,15 +1229,15 @@@ return False, None if statement.query_string[:6].lower() == 'select': - self.print_result(result, self.parse_for_select_meta(statement.query_string)) - self.print_result(rows, self.parse_for_table_meta(statement.query_string)) ++ self.print_result(rows, self.parse_for_select_meta(statement.query_string)) elif statement.query_string.lower().startswith("list users") or statement.query_string.lower().startswith("list roles"): - self.print_result(result, self.get_table_meta('system_auth', 'roles')) + self.print_result(rows, self.get_table_meta('system_auth', 'roles')) elif statement.query_string.lower().startswith("list"): - self.print_result(result, self.get_table_meta('system_auth', 'role_permissions')) - elif result: + self.print_result(rows, self.get_table_meta('system_auth', 'role_permissions')) + elif rows: # CAS INSERT/UPDATE self.writeresult("") - self.print_static_result(list(result), self.parse_for_update_meta(statement.query_string)) - self.print_static_result(rows, self.parse_for_table_meta(statement.query_string)) ++ self.print_static_result(rows, self.parse_for_update_meta(statement.query_string)) self.flush_output() return True, future