cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: cqlsh: fix handling of semicolons inside BATCH queries
Date Mon, 08 Jul 2013 19:58:21 GMT
Updated Branches:
  refs/heads/cassandra-1.2 909b2ed1a -> c1d71213b


cqlsh: fix handling of semicolons inside BATCH queries

patch by Aleksey Yeschenko; reviewed by Brandon Williams for
CASSANDRA-5697


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

Branch: refs/heads/cassandra-1.2
Commit: c1d71213bdb6f5d326f5cc5a55e645a8edf2e589
Parents: 909b2ed
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Jul 8 22:57:35 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Jul 8 22:57:35 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                    |  1 +
 pylib/cqlshlib/cql3handling.py |  4 ++--
 pylib/cqlshlib/cqlhandling.py  | 10 ++++------
 3 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c1d71213/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7c16cd0..65dd404 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,7 @@
  * Fix skipping range tombstones with reverse queries (CASSANDRA-5712)
  * Expire entries out of ThriftSessionManager (CASSANRDA-5719)
  * Don't keep ancestor information in memory (CASSANDRA-5342)
+ * cqlsh: fix handling of semicolons inside BATCH queries (CASSANDRA-5697)
 
 
 1.2.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c1d71213/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py
index 0e631ea..92701d6 100644
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@ -986,8 +986,8 @@ syntax_rules += r'''
 <batchStatement> ::= "BEGIN" ( "UNLOGGED" | "COUNTER" )? "BATCH"
                         ( "USING" [batchopt]=<usingOption>
                                   ( "AND" [batchopt]=<usingOption> )* )?
-                        [batchstmt]=<batchStatementMember> ";"
-                            ( [batchstmt]=<batchStatementMember> ";" )*
+                        [batchstmt]=<batchStatementMember> ";"?
+                            ( [batchstmt]=<batchStatementMember> ";"? )*
                      "APPLY" "BATCH"
                    ;
 <batchStatementMember> ::= <insertStatement>

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c1d71213/pylib/cqlshlib/cqlhandling.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/cqlhandling.py b/pylib/cqlshlib/cqlhandling.py
index 83e1dc2..7d36301 100644
--- a/pylib/cqlshlib/cqlhandling.py
+++ b/pylib/cqlshlib/cqlhandling.py
@@ -189,13 +189,11 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
                 output[-1].extend(stmt)
             else:
                 output.append(stmt)
-            if len(stmt) > 1 \
-            and stmt[0][0] == 'identifier' and stmt[1][0] == 'identifier' \
-            and stmt[1][1].lower() == 'batch':
-                if stmt[0][1].lower() == 'begin':
-                    in_batch = True
-                elif stmt[0][1].lower() == 'apply':
+            if len(stmt) > 2:
+                if stmt[-3][0] == 'K_APPLY':
                     in_batch = False
+                elif stmt[0][0] == 'K_BEGIN':
+                    in_batch = True
         return output, in_batch
 
     def cql_complete_single(self, text, partial, init_bindings={}, ignore_case=True,


Mime
View raw message