Updated Branches: refs/heads/trunk 0f8351004 -> f8129b435
cqlsh: support moving CL to the protocol level Patch by Aleksey Yeschenko, reviewed by brandonwilliams for CASSANDRA-4823 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f8129b43 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f8129b43 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f8129b43 Branch: refs/heads/trunk Commit: f8129b43568f09cbb843813b43524e43172d95c5 Parents: 0f83510 Author: Brandon Williams <[email protected]> Authored: Fri Oct 19 14:11:53 2012 -0500 Committer: Brandon Williams <[email protected]> Committed: Fri Oct 19 14:11:53 2012 -0500 ---------------------------------------------------------------------- bin/cqlsh | 2 +- lib/cql-internal-only-1.3.0.zip | Bin 90260 -> 0 bytes lib/cql-internal-only-1.4.0.zip | Bin 0 -> 91855 bytes pylib/cqlshlib/cql3handling.py | 20 +++++++------------- pylib/cqlshlib/tfactory.py | 5 ++--- 5 files changed, 10 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8129b43/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index bb440e0..84543f4 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -450,7 +450,7 @@ class Shell(cmd.Cmd): else: transport = transport_factory(hostname, port, os.environ, CONFIG_FILE) self.conn = cql.connect(hostname, port, user=username, password=password, - transport=transport) + cql_version=cqlver, transport=transport) self.set_expanded_cql_version(cqlver) # we could set the keyspace through cql.connect(), but as of 1.0.10, # it doesn't quote the keyspace for USE :( http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8129b43/lib/cql-internal-only-1.3.0.zip ---------------------------------------------------------------------- diff --git a/lib/cql-internal-only-1.3.0.zip b/lib/cql-internal-only-1.3.0.zip deleted file mode 100644 index 1fde059..0000000 Binary files a/lib/cql-internal-only-1.3.0.zip and /dev/null differ http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8129b43/lib/cql-internal-only-1.4.0.zip ---------------------------------------------------------------------- diff --git a/lib/cql-internal-only-1.4.0.zip b/lib/cql-internal-only-1.4.0.zip new file mode 100644 index 0000000..10dfeaf Binary files /dev/null and b/lib/cql-internal-only-1.4.0.zip differ http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8129b43/pylib/cqlshlib/cql3handling.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index 8728f60..8e0d987 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -218,6 +218,7 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ; | <float> | <uuid> ; + <tokenDefinition> ::= token="TOKEN" "(" <term> ( "," <term> )* ")" | <stringLiteral> ; @@ -728,7 +729,6 @@ syntax_rules += r''' ; <selectStatement> ::= "SELECT" <selectClause> "FROM" cf=<columnFamilyName> - ("USING" "CONSISTENCY" selcl=<consistencylevel>)? ("WHERE" <whereClause>)? ("ORDER" "BY" <orderByClause> ( "," <orderByClause> )* )? ("LIMIT" <wholenumber>)? @@ -753,10 +753,6 @@ syntax_rules += r''' ; ''' -@completer_for('selectStatement', 'selcl') -def select_statement_consistencylevel(ctxt, cass): - return [cl for cl in CqlRuleSet.consistency_levels if cl != 'ANY'] - @completer_for('orderByClause', 'ordercol') def select_order_column_completer(ctxt, cass): prev_order_cols = ctxt.get_binding('ordercol', ()) @@ -815,8 +811,7 @@ syntax_rules += r''' ( "USING" [insertopt]=<usingOption> ( "AND" [insertopt]=<usingOption> )* )? ; -<usingOption> ::= "CONSISTENCY" <consistencylevel> - | "TIMESTAMP" <wholenumber> +<usingOption> ::= "TIMESTAMP" <wholenumber> | "TTL" <wholenumber> ; ''' @@ -860,7 +855,7 @@ def insert_valcomma_completer(ctxt, cass): @completer_for('insertStatement', 'insertopt') def insert_option_completer(ctxt, cass): - opts = set('CONSISTENCY TIMESTAMP TTL'.split()) + opts = set('TIMESTAMP TTL'.split()) for opt in ctxt.get_binding('insertopt', ()): opts.discard(opt.split()[0]) return opts @@ -882,7 +877,7 @@ syntax_rules += r''' @completer_for('updateStatement', 'updateopt') def insert_option_completer(ctxt, cass): - opts = set('CONSISTENCY TIMESTAMP TTL'.split()) + opts = set('TIMESTAMP TTL'.split()) for opt in ctxt.get_binding('updateopt', ()): opts.discard(opt.split()[0]) return opts @@ -953,14 +948,13 @@ syntax_rules += r''' ; <deleteSelector> ::= delcol=<cident> ( memberbracket="[" memberselector=<term> "]" )? ; -<deleteOption> ::= "CONSISTENCY" <consistencylevel> - | "TIMESTAMP" <wholenumber> +<deleteOption> ::= "TIMESTAMP" <wholenumber> ; ''' @completer_for('deleteStatement', 'delopt') def delete_opt_completer(ctxt, cass): - opts = set('CONSISTENCY TIMESTAMP'.split()) + opts = set('TIMESTAMP'.split()) for opt in ctxt.get_binding('delopt', ()): opts.discard(opt.split()[0]) return opts @@ -988,7 +982,7 @@ syntax_rules += r''' @completer_for('batchStatement', 'batchopt') def batch_opt_completer(ctxt, cass): - opts = set('CONSISTENCY TIMESTAMP'.split()) + opts = set('TIMESTAMP'.split()) for opt in ctxt.get_binding('batchopt', ()): opts.discard(opt.split()[0]) return opts http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8129b43/pylib/cqlshlib/tfactory.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/tfactory.py b/pylib/cqlshlib/tfactory.py index d16c8e7..cc02e88 100644 --- a/pylib/cqlshlib/tfactory.py +++ b/pylib/cqlshlib/tfactory.py @@ -27,6 +27,5 @@ def regular_transport_factory(host, port, env, config_file): * env ..........: environment variables (os.environ) - not used by this implementation. * config_file ..: path to cqlsh config file - not used by this implementation. """ - socket = TSocket.TSocket(host, port) - socket.open() - return TTransport.TFramedTransport(socket) + tsocket = TSocket.TSocket(host, port) + return TTransport.TFramedTransport(tsocket)
