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, AlterViewStatement, CreateAggregateStatement, CreateFunctionStatement, CreateIndexStatement, CreateKeyspaceStatement, CreateTableStatement, CreateTriggerStatement, CreateTypeStatement, CreateViewStatement, DropAggregateStatement, DropFunctionStatement, DropIndexStatement, DropKeyspaceStatement, DropTableStatement, DropTriggerStatement, DropTypeStatement, DropViewStatement

    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
`protected` `SchemaAlteringStatement()`
`protected` `SchemaAlteringStatement(CFName name)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract Event.SchemaChange` `announceMigration(QueryState queryState, boolean isLocalOnly)` Announces the migration to other nodes in the cluster.
`ResultMessage` `execute(QueryState state, QueryOptions options, long queryStartNanoTime)` 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(ClientState clientState)`
`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, 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(ClientState clientState)

Specified by:
  `prepare` in class `ParsedStatement`

#### 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

    protected abstract Event.SchemaChange announceMigration(QueryState queryState,
                                                            boolean isLocalOnly)
                                                     throws RequestValidationException

Announces the migration to other nodes in the cluster.

Returns:
  the schema change event corresponding to the execution of this statement, or `null` if no schema change has occurred (when IF NOT EXISTS is used, for example)
Throws:
  `RequestValidationException`

#### execute

    public ResultMessage execute(QueryState state,
                                 QueryOptions options,
                                 long queryStartNanoTime)
                          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, ...)
  `queryStartNanoTime` - the timestamp returned by System.nanoTime() when this statement was received
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