CreateKeyspaceStatement (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.cql3.statements

## Class CreateKeyspaceStatement

- java.lang.Object
- - org.apache.cassandra.cql3.statements.ParsedStatement
  - - org.apache.cassandra.cql3.statements.CFStatement
    - - org.apache.cassandra.cql3.statements.SchemaAlteringStatement
      - - org.apache.cassandra.cql3.statements.CreateKeyspaceStatement

- All Implemented Interfaces:
    CQLStatement

      public class CreateKeyspaceStatement
      extends SchemaAlteringStatement

  A `CREATE KEYSPACE` statement parsed from a CQL query.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.cql3.statements.ParsedStatement

      `ParsedStatement.Prepared`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.cql3.statements.CFStatement

      `cfName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CreateKeyspaceStatement(java.lang.String name, KSPropDefs attrs, boolean ifNotExists)` Creates a new `CreateKeyspaceStatement` instance for a given keyspace name and keyword arguments.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `announceMigration(boolean isLocalOnly)` Announces the migration to other nodes in the cluster.
    `Event.SchemaChange` | `changeEvent()`
    `void` | `checkAccess(ClientState state)` Perform any access verification necessary for the statement.
    `java.lang.String` | `keyspace()`
    `void` | `validate(ClientState state)` The `CqlParser` only goes as far as extracting the keyword arguments from these statements, so this method is responsible for processing and validating.

    - ### Methods inherited from class org.apache.cassandra.cql3.statements.SchemaAlteringStatement

      `execute, executeInternal, getBoundTerms, prepare, prepareKeyspace`

    - ### Methods inherited from class org.apache.cassandra.cql3.statements.CFStatement

      `columnFamily, prepareKeyspace`

    - ### Methods inherited from class org.apache.cassandra.cql3.statements.ParsedStatement

      `getBoundVariables, setBoundVariables`

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

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

- - ### Constructor Detail

    - #### CreateKeyspaceStatement

          public CreateKeyspaceStatement(java.lang.String name,
                                 KSPropDefs attrs,
                                 boolean ifNotExists)

      Creates a new `CreateKeyspaceStatement` instance for a given keyspace name and keyword arguments.
      Parameters:
        `name` - the name of the keyspace to create
        `attrs` - map of the raw keyword arguments that followed the `WITH` keyword.

  - ### Method Detail

    - #### keyspace

          public java.lang.String keyspace()

      Overrides:
        `keyspace` in class `CFStatement`

    - #### checkAccess

          public void checkAccess(ClientState state)
                           throws UnauthorizedException

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

    - #### validate

          public void validate(ClientState state)
                        throws RequestValidationException

      The `CqlParser` only goes as far as extracting the keyword arguments from these statements, so this method is responsible for processing and validating.
      Parameters:
        `state` - the current client state
      Throws:
        `InvalidRequestException` - if arguments are missing or unacceptable
        `RequestValidationException`

    - #### announceMigration

          public boolean announceMigration(boolean isLocalOnly)
                                    throws RequestValidationException

      Description copied from class: `SchemaAlteringStatement`
      Announces the migration to other nodes in the cluster.
      Specified by:
        `announceMigration` in class `SchemaAlteringStatement`
      Returns:
        true if the execution of this statement resulted in a schema change, false otherwise (when IF NOT EXISTS is used, for example)
      Throws:
        `RequestValidationException`

    - #### changeEvent

          public Event.SchemaChange changeEvent()

      Specified by:
        `changeEvent` in class `SchemaAlteringStatement`

Copyright © 2014 The Apache Software Foundation