cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [5/13] git commit: Validate keys from CQL3 mutations. Patch by paul cannon, reviewed by xedin for CASSANDRA-3612
Date Wed, 28 Mar 2012 17:05:40 GMT
Validate keys from CQL3 mutations.
Patch by paul cannon, reviewed by xedin for CASSANDRA-3612


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

Branch: refs/heads/trunk
Commit: 2b44e546096a8b2dc1f20be2165e6044b15dd276
Parents: 51c0555
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Wed Mar 28 12:02:27 2012 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Wed Mar 28 12:02:27 2012 -0500

----------------------------------------------------------------------
 .../cassandra/cql3/statements/DeleteStatement.java |    1 +
 .../cassandra/cql3/statements/UpdateStatement.java |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2b44e546/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
index 4eb05df..7e322a6 100644
--- a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
@@ -100,6 +100,7 @@ public class DeleteStatement extends ModificationStatement
     public RowMutation mutationForKey(CFDefinition cfDef, ClientState clientState, ByteBuffer
key, ColumnNameBuilder builder, List<ByteBuffer> variables)
     throws InvalidRequestException
     {
+        QueryProcessor.validateKey(key);
         RowMutation rm = new RowMutation(cfDef.cfm.ksName, key);
 
         if (columns.isEmpty() && builder.componentCount() == 0)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2b44e546/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java b/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
index a1724d9..186ee80 100644
--- a/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
@@ -56,7 +56,7 @@ public class UpdateStatement extends ModificationStatement
      * Creates a new UpdateStatement from a column family name, columns map, consistency
      * level, and key term.
      *
-     * @param name column family name
+     * @param name column family being operated on
      * @param columns a map of column name/values pairs
      * @param whereClause the where clause
      * @param attrs additional attributes for statement (CL, timestamp, timeToLive)
@@ -79,7 +79,7 @@ public class UpdateStatement extends ModificationStatement
      * key, and lists of column names and values.  It is intended for use with the
      * alternate update format, <code>INSERT</code>.
      *
-     * @param name column family name
+     * @param name column family being operated on
      * @param columnNames list of column names
      * @param columnValues list of column values (corresponds to names)
      * @param attrs additional attributes for statement (CL, timestamp, timeToLive)
@@ -142,6 +142,12 @@ public class UpdateStatement extends ModificationStatement
     /**
      * Compute a row mutation for a single key
      *
+     * @param cfDef column family being operated on
+     * @param clientState user/session state
+     * @param key key to change
+     * @param builder ongoing column name accumulator for the current statement
+     * @param variables positional values
+     *
      * @return row mutation
      *
      * @throws InvalidRequestException on the wrong request
@@ -152,6 +158,8 @@ public class UpdateStatement extends ModificationStatement
         validateKey(key);
         // if true we need to wrap RowMutation into CounterMutation
         boolean hasCounterColumn = false;
+
+        QueryProcessor.validateKey(key);
         RowMutation rm = new RowMutation(cfDef.cfm.ksName, key);
         ColumnFamily cf = rm.addOrGet(cfDef.cfm.cfName);
 


Mime
View raw message