Update CQL doc for CASSANDRA-6839 (non equal conditions in LWT) patch by slebresne; reviewed by blerer for CASSANDRA-10752
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/41bb4bcd Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/41bb4bcd Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/41bb4bcd Branch: refs/heads/cassandra-3.5 Commit: 41bb4bcd09da39924585a4d9be75d77f556647c4 Parents: 0c53c3a Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Thu Mar 17 09:54:05 2016 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Thu Mar 17 10:18:32 2016 +0100 ---------------------------------------------------------------------- doc/cql3/CQL.textile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/41bb4bcd/doc/cql3/CQL.textile ---------------------------------------------------------------------- diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile index 812a75e..87a4be9 100644 --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@ -639,14 +639,18 @@ bc(syntax).. | <identifier> '=' <identifier> '+' <map-literal> | <identifier> '[' <term> ']' '=' <term> -<condition> ::= <identifier> '=' <term> - | <identifier> '[' <term> ']' '=' <term> +<condition> ::= <identifier> <op> <term> + | <identifier> IN (<variable> | '(' ( <term> ( ',' <term> )* )? ')') + | <identifier> '[' <term> ']' <op> <term> + | <identifier> '[' <term> ']' IN <term> + +<op> ::= '<' | '<=' | '=' | '!=' | '>=' | '>' <where-clause> ::= <relation> ( AND <relation> )* <relation> ::= <identifier> '=' <term> | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')' - | <identifier> IN '?' + | <identifier> IN <variable> <option> ::= TIMESTAMP <integer> | TTL <integer> @@ -664,7 +668,7 @@ UPDATE UserActions SET total = total + 2 WHERE user = B70DE1D0-9908-4AE3-BE34-55 p. The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@ (the @IN@ relation is only supported for the last column of the partition key). Other columns values are specified through @<assignment>@ after the @SET@ keyword. -Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row by default: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. +Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row by default (except through the use of @<condition>@, see below): the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. It is however possible to use the conditions on some columns through @IF@, in which case the row will not be updated unless such condition are met. But please note that using @IF@ conditions will incur a non negligible performance cost (internally, Paxos will be used) so this should be used sparingly. @@ -698,10 +702,14 @@ bc(syntax).. <relation> ::= <identifier> '=' <term> | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')' - | <identifier> IN '?' + | <identifier> IN <variable> + +<condition> ::= <identifier> <op> <term> + | <identifier> IN (<variable> | '(' ( <term> ( ',' <term> )* )? ')') + | <identifier> '[' <term> ']' <op> <term> + | <identifier> '[' <term> ']' IN <term> -<condition> ::= <identifier> '=' <term> - | <identifier> '[' <term> ']' '=' <term> +<op> ::= '<' | '<=' | '=' | '!=' | '>=' | '>' p. __Sample:__