BatchStatement (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.cql3.statements

## Class BatchStatement

- java.lang.Object
- - org.apache.cassandra.cql3.statements.BatchStatement

- All Implemented Interfaces:
    CQLStatement

      public class BatchStatement
      extends java.lang.Object
      implements CQLStatement

  A `BATCH` statement parsed from a CQL query.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `BatchStatement.BatchVariables`
    `static class` | `BatchStatement.Parsed`
    `static class` | `BatchStatement.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `BatchStatement.Type` | `type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BatchStatement(int boundTerms, BatchStatement.Type type, java.util.List<ModificationStatement> statements, Attributes attrs)` Creates a new BatchStatement from a list of statements and a Thrift consistency level.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkAccess(ClientState state)` Perform any access verification necessary for the statement.
    `ResultMessage` | `execute(QueryState queryState, BatchQueryOptions options)`
    `ResultMessage` | `execute(QueryState queryState, QueryOptions options)` Execute the statement and return the resulting result or null if there is no result.
    `ResultMessage` | `executeInternal(QueryState queryState, QueryOptions options)` Variant of execute used for internal query against the system tables, and thus only query the local node.
    `int` | `getBoundTerms()` Returns the number of bound terms in this statement.
    `java.lang.Iterable<Function>` | `getFunctions()` Return an Iterable over all of the functions (both native and user-defined) used by any component of the statement
    `java.util.List<ModificationStatement>` | `getStatements()`
    `java.lang.String` | `toString()`
    `void` | `validate()`
    `void` | `validate(ClientState state)` Perform additional validation required by the statment.
    `static void` | `verifyBatchSize(java.lang.Iterable<ColumnFamily> cfs)` Checks batch size to ensure threshold is met.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### type

          public final BatchStatement.Type type

  - ### Constructor Detail

    - #### BatchStatement

          public BatchStatement(int boundTerms,
                                BatchStatement.Type type,
                                java.util.List<ModificationStatement> statements,
                                Attributes attrs)

      Creates a new BatchStatement from a list of statements and a Thrift consistency level.
      Parameters:
        `type` - type of the batch
        `statements` - a list of UpdateStatements
        `attrs` - additional attributes for statement (CL, timestamp, timeToLive)

  - ### Method Detail

    - #### getFunctions

          public java.lang.Iterable<Function> getFunctions()

      Description copied from interface: `CQLStatement`
      Return an Iterable over all of the functions (both native and user-defined) used by any component of the statement
      Specified by:
        `getFunctions` in interface `CQLStatement`
      Returns:
        functions all functions found (may contain duplicates)

    - #### getBoundTerms

          public int getBoundTerms()

      Description copied from interface: `CQLStatement`
      Returns the number of bound terms in this statement.
      Specified by:
        `getBoundTerms` in interface `CQLStatement`

    - #### checkAccess

          public void checkAccess(ClientState state)
                           throws InvalidRequestException,
                                  UnauthorizedException

      Description copied from interface: `CQLStatement`
      Perform any access verification necessary for the statement.
      Specified by:
        `checkAccess` in interface `CQLStatement`
      Parameters:
        `state` - the current client state
      Throws:
        `InvalidRequestException`
        `UnauthorizedException`

    - #### validate

          public void validate()
                        throws InvalidRequestException

      Throws:
        `InvalidRequestException`

    - #### validate

          public void validate(ClientState state)
                        throws InvalidRequestException

      Description copied from interface: `CQLStatement`
      Perform additional validation required by the statment. To be overriden by subclasses if needed.
      Specified by:
        `validate` in interface `CQLStatement`
      Parameters:
        `state` - the current client state
      Throws:
        `InvalidRequestException`

    - #### getStatements

          public java.util.List<ModificationStatement> getStatements()

    - #### verifyBatchSize

          public static void verifyBatchSize(java.lang.Iterable<ColumnFamily> cfs)
                                      throws InvalidRequestException

      Checks batch size to ensure threshold is met. If not, a warning is logged.
      Parameters:
        `cfs` - ColumnFamilies that will store the batch's mutations.
      Throws:
        `InvalidRequestException`

    - #### execute

          public ResultMessage execute(QueryState queryState,
                                       QueryOptions options)
                                throws RequestExecutionException,
                                       RequestValidationException

      Description copied from interface: `CQLStatement`
      Execute the statement and return the resulting result or null if there is no result.
      Specified by:
        `execute` in interface `CQLStatement`
      Parameters:
        `queryState` - the current query state
        `options` - options for this query (consistency, variables, pageSize, ...)
      Throws:
        `RequestExecutionException`
        `RequestValidationException`

    - #### execute

          public ResultMessage execute(QueryState queryState,
                                       BatchQueryOptions options)
                                throws RequestExecutionException,
                                       RequestValidationException

      Throws:
        `RequestExecutionException`
        `RequestValidationException`

    - #### executeInternal

          public ResultMessage executeInternal(QueryState queryState,
                                               QueryOptions options)
                                        throws RequestValidationException,
                                               RequestExecutionException

      Description copied from interface: `CQLStatement`
      Variant of execute used for internal query against the system tables, and thus only query the local node.
      Specified by:
        `executeInternal` in interface `CQLStatement`
      Parameters:
        `queryState` - the current query state
      Throws:
        `RequestValidationException`
        `RequestExecutionException`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2018 The Apache Software Foundation