Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gudusoft.gsqlparser.nodes
Class TConstraint

    java.lang.Object
      gudusoft.gsqlparser.nodes.TParseTreeNode
          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.

- A NOT NULL constraint prohibits a database value from being null.
- A unique constraint prohibits multiple rows from having the same value in the same column or combination of columns but allows some values to be null.
- A primary key constraint combines a NOT NULL constraint and a unique constraint in a single declaration. It prohibits multiple rows from having the same value in the same column or combination of columns and prohibits values from being null.
- A foreign key constraint requires values in one table to match values in another table.
- A check constraint requires a value in the database to comply with a specified condition.
- A REF column by definition references an object in another object type or in a relational table. A REF constraint lets you further describe the relationship between the REF column and the object it references.
- default constraint is valid in sql server.

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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD