mirror of https://github.com/apache/cassandra
cqlsh: fix handling of semicolons inside BATCH queries
patch by Aleksey Yeschenko; reviewed by Brandon Williams for CASSANDRA-5697
This commit is contained in:
parent
909b2ed1a9
commit
c1d71213bd
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue