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

org.apache.cassandra.cql3.statements

## Class SchemaAlteringStatement

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

- All Implemented Interfaces:
    CQLStatement
  Direct Known Subclasses:
    AlterKeyspaceStatement, AlterTableStatement, AlterTypeStatement, CreateAggregateStatement, CreateFunctionStatement, CreateIndexStatement, CreateKeyspaceStatement, CreateTableStatement, CreateTriggerStatement, CreateTypeStatement, DropAggregateStatement, DropFunctionStatement, DropIndexStatement, DropKeyspaceStatement, DropTableStatement, DropTriggerStatement, DropTypeStatement

      public abstract class SchemaAlteringStatement
      extends CFStatement
      implements CQLStatement

  Abstract class for statements that alter the schema.

- - ### 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
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SchemaAlteringStatement()`
    `protected` | `SchemaAlteringStatement(CFName name)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract boolean` | `announceMigration(boolean isLocalOnly)` Announces the migration to other nodes in the cluster.
    `abstract Event.SchemaChange` | `changeEvent()`
    `ResultMessage` | `execute(QueryState state, QueryOptions options)` Execute the statement and return the resulting result or null if there is no result.
    `ResultMessage` | `executeInternal(QueryState state, 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.
    `protected void` | `grantPermissionsToCreator(QueryState state)` Schema alteration may result in a new database object (keyspace, table, role, function) being created capable of having permissions GRANTed on it.
    `ParsedStatement.Prepared` | `prepare()`
    `void` | `prepareKeyspace(ClientState state)`

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

      `columnFamily, keyspace, prepareKeyspace`

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

      `getBoundVariables, getFunctions, setBoundVariables`

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

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

    - ### Methods inherited from interface org.apache.cassandra.cql3.CQLStatement

      `checkAccess, getFunctions, validate`

- - ### Constructor Detail

    - #### SchemaAlteringStatement

          protected SchemaAlteringStatement()

    - #### SchemaAlteringStatement

          protected SchemaAlteringStatement(CFName name)

  - ### Method Detail

    - #### getBoundTerms

          public int getBoundTerms()

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

    - #### prepareKeyspace

          public void prepareKeyspace(ClientState state)
                               throws InvalidRequestException

      Overrides:
        `prepareKeyspace` in class `CFStatement`
      Throws:
        `InvalidRequestException`

    - #### prepare

          public ParsedStatement.Prepared prepare()

      Specified by:
        `prepare` in class `ParsedStatement`

    - #### changeEvent

          public abstract Event.SchemaChange changeEvent()

    - #### grantPermissionsToCreator

          protected void grantPermissionsToCreator(QueryState state)

      Schema alteration may result in a new database object (keyspace, table, role, function) being created capable of having permissions GRANTed on it. The creator of the object (the primary role assigned to the AuthenticatedUser performing the operation) is automatically granted ALL applicable permissions on the object. This is a hook for subclasses to override in order to perform that grant when the statement is executed.

    - #### announceMigration

          public abstract boolean announceMigration(boolean isLocalOnly)
                                             throws RequestValidationException

      Announces the migration to other nodes in the cluster.
      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`

    - #### execute

          public ResultMessage execute(QueryState state,
                                       QueryOptions options)
                                throws 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:
        `state` - the current query state
        `options` - options for this query (consistency, variables, pageSize, ...)
      Throws:
        `RequestValidationException`

    - #### executeInternal

          public ResultMessage executeInternal(QueryState state,
                                               QueryOptions options)

      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:
        `state` - the current query state

Copyright © 2018 The Apache Software Foundation