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)
|
* Fix skipping range tombstones with reverse queries (CASSANDRA-5712)
|
||||||
* Expire entries out of ThriftSessionManager (CASSANRDA-5719)
|
* Expire entries out of ThriftSessionManager (CASSANRDA-5719)
|
||||||
* Don't keep ancestor information in memory (CASSANDRA-5342)
|
* Don't keep ancestor information in memory (CASSANDRA-5342)
|
||||||
|
* cqlsh: fix handling of semicolons inside BATCH queries (CASSANDRA-5697)
|
||||||
|
|
||||||
|
|
||||||
1.2.6
|
1.2.6
|
||||||
|
|
|
||||||
|
|
@ -986,8 +986,8 @@ syntax_rules += r'''
|
||||||
<batchStatement> ::= "BEGIN" ( "UNLOGGED" | "COUNTER" )? "BATCH"
|
<batchStatement> ::= "BEGIN" ( "UNLOGGED" | "COUNTER" )? "BATCH"
|
||||||
( "USING" [batchopt]=<usingOption>
|
( "USING" [batchopt]=<usingOption>
|
||||||
( "AND" [batchopt]=<usingOption> )* )?
|
( "AND" [batchopt]=<usingOption> )* )?
|
||||||
[batchstmt]=<batchStatementMember> ";"
|
[batchstmt]=<batchStatementMember> ";"?
|
||||||
( [batchstmt]=<batchStatementMember> ";" )*
|
( [batchstmt]=<batchStatementMember> ";"? )*
|
||||||
"APPLY" "BATCH"
|
"APPLY" "BATCH"
|
||||||
;
|
;
|
||||||
<batchStatementMember> ::= <insertStatement>
|
<batchStatementMember> ::= <insertStatement>
|
||||||
|
|
|
||||||
|
|
@ -189,13 +189,11 @@ class CqlParsingRuleSet(pylexotron.ParsingRuleSet):
|
||||||
output[-1].extend(stmt)
|
output[-1].extend(stmt)
|
||||||
else:
|
else:
|
||||||
output.append(stmt)
|
output.append(stmt)
|
||||||
if len(stmt) > 1 \
|
if len(stmt) > 2:
|
||||||
and stmt[0][0] == 'identifier' and stmt[1][0] == 'identifier' \
|
if stmt[-3][0] == 'K_APPLY':
|
||||||
and stmt[1][1].lower() == 'batch':
|
|
||||||
if stmt[0][1].lower() == 'begin':
|
|
||||||
in_batch = True
|
|
||||||
elif stmt[0][1].lower() == 'apply':
|
|
||||||
in_batch = False
|
in_batch = False
|
||||||
|
elif stmt[0][0] == 'K_BEGIN':
|
||||||
|
in_batch = True
|
||||||
return output, in_batch
|
return output, in_batch
|
||||||
|
|
||||||
def cql_complete_single(self, text, partial, init_bindings={}, ignore_case=True,
|
def cql_complete_single(self, text, partial, init_bindings={}, ignore_case=True,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue