gudusoft.gsqlparser.nodes
Class TConstraint

java.lang.Object
  extended by gudusoft.gsqlparser.nodes.TParseTreeNode
      extended by gudusoft.gsqlparser.nodes.TConstraint
All Implemented Interfaces:
Visitable

public class TConstraint
extends TParseTreeNode

Use a constraint to define an integrity constraint¡ªa rule that restricts the values in a database.

Oracle Database lets you create six types of constraints and lets you declare them in two ways.

See Also:
EConstraintType.notnull, EConstraintType.unique, EConstraintType.primary_key, EConstraintType.foreign_key, EConstraintType.check, EConstraintType.reference, EConstraintType.default_value

Constructor Summary
TConstraint()
           
 
Method Summary
 void accept(TParseTreeVisitor v)
           
 TPTNodeList<TAutomaticProperty> getAutomaticProperties()
           
 TExpression getCheckCondition()
           
 TObjectNameList getColumnList()
           
 EConstraintType getConstraint_type()
           
 int getConstraintLevel()
           
 TObjectName getConstraintName()
           
 TExpression getDefaultExpression()
           
 TExpression getIncrement()
          Used internal
 TPTNodeList<TKeyAction> getKeyActions()
           
 TObjectNameList getReferencedColumnList()
           
 TObjectName getReferencedObject()
           
 TExpression getSeed()
          Used internal
 void init(java.lang.Object arg1)
          Initialize a query tree node.
 void setAutomaticProperties(TPTNodeList<TAutomaticProperty> automaticProperties)
           
 void setConstraint_type(EConstraintType constraint_type)
           
 void setConstraintLevel(int constraintLevel)
           
 void setConstraintName(TObjectName constraintName)
           
 void setDefaultExpression(TExpression defaultExpression)
           
 void setIncrement(TExpression increment)
           
 void setKeyActions(TPTNodeList<TKeyAction> keyActions)
           
 void setReferencedColumnList(TObjectNameList referencedColumnList)
           
 void setReferencedObject(TObjectName referencedObject)
           
 void setSeed(TExpression seed)
           
 
Methods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
addAllMyTokensToTokenList, doParse, getColumnNo, getDummyTag, getEndToken, getGsqlparser, getLineNo, getNodeType, getStartToken, init, init, init, init, init, setDummyTag, setEndToken, setEndToken, setGsqlparser, setNodeType, setStartToken, setStartToken, setString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TConstraint

public TConstraint()
Method Detail

setKeyActions

public void setKeyActions(TPTNodeList<TKeyAction> keyActions)

getKeyActions

public TPTNodeList<TKeyAction> getKeyActions()

setConstraintLevel

public void setConstraintLevel(int constraintLevel)

getConstraintLevel

public int getConstraintLevel()
Returns:
is this a columnn level constraint or table level constraint TBaseType.constraint_level_table or TBaseType.constraint_level_column.

setDefaultExpression

public void setDefaultExpression(TExpression defaultExpression)

getDefaultExpression

public TExpression getDefaultExpression()
Returns:
default expression of sql server.

setConstraintName

public void setConstraintName(TObjectName constraintName)

getConstraintName

public TObjectName getConstraintName()
Returns:
name for the constraint, it's optional.

setConstraint_type

public void setConstraint_type(EConstraintType constraint_type)

getConstraint_type

public EConstraintType getConstraint_type()
Returns:
type of constraints.
See Also:
EConstraintType.notnull, EConstraintType.unique, EConstraintType.primary_key, EConstraintType.foreign_key, EConstraintType.check, EConstraintType.reference, EConstraintType.default_value

setAutomaticProperties

public void setAutomaticProperties(TPTNodeList<TAutomaticProperty> automaticProperties)

getAutomaticProperties

public TPTNodeList<TAutomaticProperty> getAutomaticProperties()
Returns:
Automatic Initialization and Updating for TIMESTAMP in MySQL

getCheckCondition

public TExpression getCheckCondition()
Returns:
used in check constraint, requires a value in the database to comply with this specified condition.

getColumnList

public TObjectNameList getColumnList()
Returns:
column name list used when constraint type is unique, primary key or foreign key.

init

public void init(java.lang.Object arg1)
Description copied from class: TParseTreeNode
Initialize a query tree node.

Overrides:
init in class TParseTreeNode

setReferencedColumnList

public void setReferencedColumnList(TObjectNameList referencedColumnList)

getReferencedColumnList

public TObjectNameList getReferencedColumnList()
Returns:
column name list of referenced object in reference clause when constraint type is REF constraint.

setReferencedObject

public void setReferencedObject(TObjectName referencedObject)

getReferencedObject

public TObjectName getReferencedObject()
Returns:
referenced object in reference clause when constraint type is REF constraint.

setIncrement

public void setIncrement(TExpression increment)

setSeed

public void setSeed(TExpression seed)

getIncrement

public TExpression getIncrement()
Used internal

Returns:

getSeed

public TExpression getSeed()
Used internal

Returns:

accept

public void accept(TParseTreeVisitor v)
Specified by:
accept in interface Visitable
Overrides:
accept in class TParseTreeNode