protected void parseConstraintAttributes ( DdlTokenStream tokens , AstNode constraintNode ) throws ParsingException { assert tokens != null ; assert constraintNode != null ; // Now we need to check for constraint attributes: // <constraint attributes> ::= // <constraint check time> [ [ NOT ] DEFERRABLE ] // | [ NOT ] DEFERRABLE [ <constraint check time> ] // // <constraint check time> ::= // INITIALLY DEFERRED // | INITIALLY IMMEDIATE // EXAMPLE : foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED, if ( tokens . canConsume ( "INITIALLY" , "DEFERRED" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "INITIALLY DEFERRED" ) ; } if ( tokens . canConsume ( "INITIALLY" , "IMMEDIATE" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "INITIALLY IMMEDIATE" ) ; } if ( tokens . canConsume ( "NOT" , "DEFERRABLE" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "NOT DEFERRABLE" ) ; } if ( tokens . canConsume ( "DEFERRABLE" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "DEFERRABLE" ) ; } if ( tokens . canConsume ( "INITIALLY" , "DEFERRED" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "INITIALLY DEFERRED" ) ; } if ( tokens . canConsume ( "INITIALLY" , "IMMEDIATE" ) ) { AstNode attrNode = nodeFactory ( ) . node ( "CONSTRAINT_ATTRIBUTE" , constraintNode , TYPE_CONSTRAINT_ATTRIBUTE ) ; attrNode . setProperty ( PROPERTY_VALUE , "INITIALLY IMMEDIATE" ) ; } }
Parses the attributes associated with any in - line column constraint definition or a table constrain definition .