com.akiban.sql.parser
Class ColumnDefinitionNode

java.lang.Object
  extended by com.akiban.sql.parser.QueryTreeNode
      extended by com.akiban.sql.parser.TableElementNode
          extended by com.akiban.sql.parser.ColumnDefinitionNode
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
ModifyColumnNode

public class ColumnDefinitionNode
extends TableElementNode

A ColumnDefinitionNode represents a column definition in a DDL statement. There will be a ColumnDefinitionNode for each column in a CREATE TABLE statement, and for the column in an ALTER TABLE ADD COLUMN statement.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.akiban.sql.parser.TableElementNode
TableElementNode.ElementType
 
Field Summary
static int CREATE_AUTOINCREMENT
           
static int MODIFY_AUTOINCREMENT_INC_VALUE
           
static int MODIFY_AUTOINCREMENT_RESTART_VALUE
           
 
Fields inherited from class com.akiban.sql.parser.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
 
Constructor Summary
ColumnDefinitionNode()
           
 
Method Summary
 void copyFrom(QueryTreeNode node)
          Fill this node with a deep copy of the given node.
 long getAutoinc_create_or_modify_Start_Increment()
          Get the status of this autoincrement column
 long getAutoincrementIncrement()
          Get the autoincrement increment value
 long getAutoincrementStart()
          Get the autoincrement start value
 String getColumnName()
          Returns the unqualified name of the column being defined.
 DefaultNode getDefaultNode()
          Return the DefaultNode, if any, associated with this node.
 GenerationClauseNode getGenerationClauseNode()
          Get the generation clause.
 DataTypeDescriptor getType()
          Returns the data type of the column being defined.
 boolean hasGenerationClause()
          Return true if this column has a generation clause.
 void init(Object name, Object defaultNode, Object type, Object autoIncrementInfo)
          Initializer for a ColumnDefinitionNode
 boolean isAutoincrementColumn()
          Is this an autoincrement column?
 void printSubNodes(int depth)
          Prints the sub-nodes of this object.
 void setType(DataTypeDescriptor dts)
          Set the type of this column
 String toString()
          Convert this object to a String.
 
Methods inherited from class com.akiban.sql.parser.TableElementNode
getName, init, init
 
Methods inherited from class com.akiban.sql.parser.QueryTreeNode
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, getBeginOffset, getDebugOutput, getEndOffset, getNodeFactory, getNodeType, getNullNode, getParserContext, getStatementType, getUserData, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, makeTableName, makeTableName, nodeHeader, printLabel, setBeginOffset, setDebugOutput, setEndOffset, setNodeType, setParserContext, setUserData, stackPrint, treePrint, treePrint, treePrint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CREATE_AUTOINCREMENT

public static final int CREATE_AUTOINCREMENT
See Also:
Constant Field Values

MODIFY_AUTOINCREMENT_RESTART_VALUE

public static final int MODIFY_AUTOINCREMENT_RESTART_VALUE
See Also:
Constant Field Values

MODIFY_AUTOINCREMENT_INC_VALUE

public static final int MODIFY_AUTOINCREMENT_INC_VALUE
See Also:
Constant Field Values
Constructor Detail

ColumnDefinitionNode

public ColumnDefinitionNode()
Method Detail

init

public void init(Object name,
                 Object defaultNode,
                 Object type,
                 Object autoIncrementInfo)
          throws StandardException
Initializer for a ColumnDefinitionNode

Overrides:
init in class QueryTreeNode
Parameters:
name - The name of the column
defaultNode - The default value of the column
type - A DataTypeDescriptor telling the type of the column
autoIncrementInfo - Info for autoincrement columns
Throws:
StandardException - Thrown on error

copyFrom

public void copyFrom(QueryTreeNode node)
              throws StandardException
Fill this node with a deep copy of the given node.

Overrides:
copyFrom in class TableElementNode
Throws:
StandardException

toString

public String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class TableElementNode
Returns:
This object as a String

getColumnName

public String getColumnName()
Returns the unqualified name of the column being defined.

Returns:
the name of the column

getType

public final DataTypeDescriptor getType()
Returns the data type of the column being defined.

Returns:
the data type of the column

setType

public void setType(DataTypeDescriptor dts)
Set the type of this column


getDefaultNode

public DefaultNode getDefaultNode()
Return the DefaultNode, if any, associated with this node.

Returns:
The DefaultNode, if any, associated with this node.

hasGenerationClause

public boolean hasGenerationClause()
Return true if this column has a generation clause.


getGenerationClauseNode

public GenerationClauseNode getGenerationClauseNode()
Get the generation clause.


isAutoincrementColumn

public boolean isAutoincrementColumn()
Is this an autoincrement column?

Returns:
Whether or not this is an autoincrement column.

getAutoincrementStart

public long getAutoincrementStart()
Get the autoincrement start value

Returns:
Autoincrement start value.

getAutoincrementIncrement

public long getAutoincrementIncrement()
Get the autoincrement increment value

Returns:
Autoincrement increment value.

getAutoinc_create_or_modify_Start_Increment

public long getAutoinc_create_or_modify_Start_Increment()
Get the status of this autoincrement column

Returns:
ColumnDefinitionNode.CREATE_AUTOINCREMENT - if this definition is for autoincrement column creatoin ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE - if this definition is for alter sutoincrement column to change the start value ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE if this definition is for alter autoincrement column to change the increment value

printSubNodes

public void printSubNodes(int depth)
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Overrides:
printSubNodes in class QueryTreeNode
Parameters:
depth - The depth of this node in the tree


Copyright © 2013 Akiban Technologies, Inc. All rights reserved.