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/10ef01d1 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/10ef01d1 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/10ef01d1 Branch: refs/heads/cassandra-3.0 Commit: 10ef01d1cad75296b039e1ac6e2ab6498f2d8fc8 Parents: 33f1edc acf67d5 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Fri Oct 30 10:02:15 2015 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Fri Oct 30 10:02:15 2015 +0100 ---------------------------------------------------------------------- bin/cqlsh.py | 69 +++++++++---------- ...iver-internal-only-3.0.0a2.post0-95c6008.zip | Bin 0 -> 233564 bytes 2 files changed, 31 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/10ef01d1/bin/cqlsh.py ---------------------------------------------------------------------- diff --cc bin/cqlsh.py index e092d44,17bddd3..725f6e9 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1181,24 -1158,9 +1180,24 @@@ class Shell(cmd.Cmd) except Exception, err: self.printerr("Unable to fetch query trace: %s" % (str(err),)) - return result + return success - 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: @@@ -1229,15 -1191,15 +1228,15 @@@ return False, None if statement.query_string[:6].lower() == 'select': - self.print_result(rows, self.parse_for_select_meta(statement.query_string)) - self.print_result(result, self.parse_for_table_meta(statement.query_string)) ++ self.print_result(result, 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(rows, self.get_table_meta('system_auth', 'roles')) + self.print_result(result, self.get_table_meta('system_auth', 'roles')) elif statement.query_string.lower().startswith("list"): - self.print_result(rows, self.get_table_meta('system_auth', 'role_permissions')) - elif rows: + self.print_result(result, self.get_table_meta('system_auth', 'role_permissions')) + elif result: # CAS INSERT/UPDATE self.writeresult("") - self.print_static_result(rows, self.parse_for_update_meta(statement.query_string)) - self.print_static_result(list(result), self.parse_for_table_meta(statement.query_string)) ++ self.print_static_result(list(result), self.parse_for_update_meta(statement.query_string)) self.flush_output() return True, future