Package org.apache.derby.impl.sql.compile

Examples of org.apache.derby.impl.sql.compile.ConstraintDefinitionNode


    throw new Error("Missing return statement in function");
  }

  final public TableElementNode tableConstraintDefinition() throws ParseException, StandardException {
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        TableName               constraintName = null;
        //initialize following two booleans before handling table level constraints
        explicitNotNull = false;
        explicitNull = false;
    switch (jj_nt.kind) {
    case CONSTRAINT:
      constraintName = constraintNameDefinition();
      break;
    default:
      jj_la1[266] = jj_gen;
      ;
    }
    tcdn = tableConstraint(constraintName);
    switch (jj_nt.kind) {
    case DERBYDASHPROPERTIES:
      properties = propertyList(false);
      jj_consume_token(CHECK_PROPERTIES);
      break;
    default:
      jj_la1[267] = jj_gen;
      ;
    }
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here


                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }

  final public ConstraintDefinitionNode tableConstraint(TableName constraintName) throws ParseException, StandardException {
        ConstraintDefinitionNode tcdn;
    switch (jj_nt.kind) {
    case PRIMARY:
    case UNIQUE:
      tcdn = uniqueConstraintDefinition(constraintName);
                {if (true) return tcdn;}
View Full Code Here

  final public ConstraintDefinitionNode columnConstraint(TableName constraintName,
                                 DataTypeDescriptor dataTypeDescriptor,
                                 String columnName) throws ParseException, StandardException {
        int constraintType;
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        ResultColumnList refRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                getContextManager());
        TableName referencedTable;
        int[] refActions = {StatementType.RA_NOACTION,
                            StatementType.RA_NOACTION} ;
    switch (jj_nt.kind) {
    case NOT:
      jj_consume_token(NOT);
      jj_consume_token(NULL);
                //if column is explicitly defined not nullable, set following flag
                explicitNotNull = true;
                //if both null and not null constraints are defined for a column,
                //throw an exception
                if (explicitNull)
                   {if (true) throw StandardException.newException(SQLState.LANG_ADDING_COLUMN_WITH_NULL_AND_NOT_NULL_CONSTRAINT, columnName);}
                dataTypeDescriptor.setNullability(false);
                {if (true) return null;}
      break;
    case PRIMARY:
    case UNIQUE:
      //pass the columnname as the second parameter. It will be used to throw an
              //exception if null constraint is defined for this column-level primary
              //key constraint
              constraintType = uniqueSpecification(dataTypeDescriptor,columnName);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[279] = jj_gen;
        ;
      }
                ResultColumnList uniqueColumnList =
                                                                                (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());
                uniqueColumnList.addElement(
                        (ResultColumn) nodeFactory.getNode(
                                                        C_NodeTypes.RESULT_COLUMN,
                                                        columnName,
                                                        null,
                                                        getContextManager()));

                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                ReuseFactory.getInteger(constraintType),
                                                uniqueColumnList,
                                                properties,
                                                null,
                                                null,
                                                getContextManager()
                                                );}
      break;
    case REFERENCES:
      referencedTable = referencesSpecification(refRcl, refActions);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[280] = jj_gen;
        ;
      }
                ResultColumnList fkRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                        getContextManager());
                fkRcl.addElement(
                                        (ResultColumn) nodeFactory.getNode(
                                                                        C_NodeTypes.RESULT_COLUMN,
                                                                        columnName,
                                                                        null,
                                                                        getContextManager())
                                );
                tcdn = (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                referencedTable,
                                                fkRcl,
                                                refRcl,
                                                refActions,
                                                getContextManager());
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
      break;
    case CHECK:
      tcdn = checkConstraintDefinition(constraintName, columnName);
View Full Code Here

    throw new Error("Missing return statement in function");
  }

  final public TableElementNode tableConstraintDefinition() throws ParseException, StandardException {
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        TableName               constraintName = null;
        //initialize following two booleans before handling table level constraints
        explicitNotNull = false;
        explicitNull = false;
    switch (jj_nt.kind) {
    case CONSTRAINT:
      constraintName = constraintNameDefinition();
      break;
    default:
      jj_la1[266] = jj_gen;
      ;
    }
    tcdn = tableConstraint(constraintName);
    switch (jj_nt.kind) {
    case DERBYDASHPROPERTIES:
      properties = propertyList(false);
      jj_consume_token(CHECK_PROPERTIES);
      break;
    default:
      jj_la1[267] = jj_gen;
      ;
    }
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }

  final public ConstraintDefinitionNode tableConstraint(TableName constraintName) throws ParseException, StandardException {
        ConstraintDefinitionNode tcdn;
    switch (jj_nt.kind) {
    case PRIMARY:
    case UNIQUE:
      tcdn = uniqueConstraintDefinition(constraintName);
                {if (true) return tcdn;}
View Full Code Here

  final public ConstraintDefinitionNode columnConstraint(TableName constraintName,
                                 DataTypeDescriptor dataTypeDescriptor,
                                 String columnName) throws ParseException, StandardException {
        int constraintType;
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        ResultColumnList refRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                getContextManager());
        TableName referencedTable;
        int[] refActions = {StatementType.RA_NOACTION,
                            StatementType.RA_NOACTION} ;
    switch (jj_nt.kind) {
    case NOT:
      jj_consume_token(NOT);
      jj_consume_token(NULL);
                //if column is explicitly defined not nullable, set following flag
                explicitNotNull = true;
                //if both null and not null constraints are defined for a column,
                //throw an exception
                if (explicitNull)
                   {if (true) throw StandardException.newException(SQLState.LANG_ADDING_COLUMN_WITH_NULL_AND_NOT_NULL_CONSTRAINT, columnName);}
                dataTypeDescriptor.setNullability(false);
                {if (true) return null;}
      break;
    case PRIMARY:
    case UNIQUE:
      //pass the columnname as the second parameter. It will be used to throw an
              //exception if null constraint is defined for this column-level primary
              //key constraint
              constraintType = uniqueSpecification(dataTypeDescriptor,columnName);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[279] = jj_gen;
        ;
      }
                ResultColumnList uniqueColumnList =
                                                                                (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());
                uniqueColumnList.addElement(
                        (ResultColumn) nodeFactory.getNode(
                                                        C_NodeTypes.RESULT_COLUMN,
                                                        columnName,
                                                        null,
                                                        getContextManager()));

                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                ReuseFactory.getInteger(constraintType),
                                                uniqueColumnList,
                                                properties,
                                                null,
                                                null,
                                                getContextManager()
                                                );}
      break;
    case REFERENCES:
      referencedTable = referencesSpecification(refRcl, refActions);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[280] = jj_gen;
        ;
      }
                ResultColumnList fkRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                        getContextManager());
                fkRcl.addElement(
                                        (ResultColumn) nodeFactory.getNode(
                                                                        C_NodeTypes.RESULT_COLUMN,
                                                                        columnName,
                                                                        null,
                                                                        getContextManager())
                                );
                tcdn = (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                referencedTable,
                                                fkRcl,
                                                refRcl,
                                                refActions,
                                                getContextManager());
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
      break;
    case CHECK:
      tcdn = checkConstraintDefinition(constraintName, columnName);
View Full Code Here

    throw new Error("Missing return statement in function");
  }

  final public TableElementNode tableConstraintDefinition() throws ParseException, StandardException {
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        TableName               constraintName = null;
        //initialize following two booleans before handling table level constraints
        explicitNotNull = false;
        explicitNull = false;
    switch (jj_nt.kind) {
    case CONSTRAINT:
      constraintName = constraintNameDefinition();
      break;
    default:
      jj_la1[300] = jj_gen;
      ;
    }
    tcdn = tableConstraint(constraintName);
    switch (jj_nt.kind) {
    case DERBYDASHPROPERTIES:
      properties = propertyList(false);
      jj_consume_token(CHECK_PROPERTIES);
      break;
    default:
      jj_la1[301] = jj_gen;
      ;
    }
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }

  final public ConstraintDefinitionNode tableConstraint(TableName constraintName) throws ParseException, StandardException {
        ConstraintDefinitionNode tcdn;
    switch (jj_nt.kind) {
    case PRIMARY:
    case UNIQUE:
      tcdn = uniqueConstraintDefinition(constraintName);
                {if (true) return tcdn;}
View Full Code Here

  final public ConstraintDefinitionNode columnConstraint(TableName constraintName,
                                 DataTypeDescriptor[] dataTypeDescriptor,
                                 String columnName) throws ParseException, StandardException {
        int constraintType;
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        ResultColumnList refRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                getContextManager());
        TableName referencedTable;
        int[] refActions = {StatementType.RA_NOACTION,
                            StatementType.RA_NOACTION} ;
    switch (jj_nt.kind) {
    case NOT:
      jj_consume_token(NOT);
      jj_consume_token(NULL);
                //if column is explicitly defined not nullable, set following flag
                explicitNotNull = true;
                //if both null and not null constraints are defined for a column,
                //throw an exception
                if (explicitNull)
                   {if (true) throw StandardException.newException(SQLState.LANG_ADDING_COLUMN_WITH_NULL_AND_NOT_NULL_CONSTRAINT, columnName);}

                // columns with generation clauses can omit the datatype
                if ( dataTypeDescriptor[0] == null ) { {if (true) throw StandardException.newException(SQLState.LANG_NOT_NULL_NEEDS_DATATYPE);} }

                dataTypeDescriptor[0] = dataTypeDescriptor[0].getNullabilityType(false);
                {if (true) return null;}
      break;
    case PRIMARY:
    case UNIQUE:
      //pass the columnname as the second parameter. It will be used to throw an
              //exception if null constraint is defined for this column-level primary
              //key constraint
              constraintType = uniqueSpecification(columnName);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[313] = jj_gen;
        ;
      }
                ResultColumnList uniqueColumnList =
                                                                                (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());
                uniqueColumnList.addElement(
                        (ResultColumn) nodeFactory.getNode(
                                                        C_NodeTypes.RESULT_COLUMN,
                                                        columnName,
                                                        null,
                                                        getContextManager()));

                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                ReuseFactory.getInteger(constraintType),
                                                uniqueColumnList,
                                                properties,
                                                null,
                                                null,
                                                getContextManager()
                                                );}
      break;
    case REFERENCES:
      referencedTable = referencesSpecification(refRcl, refActions);
      switch (jj_nt.kind) {
      case DERBYDASHPROPERTIES:
        properties = propertyList(false);
        jj_consume_token(CHECK_PROPERTIES);
        break;
      default:
        jj_la1[314] = jj_gen;
        ;
      }
                ResultColumnList fkRcl = (ResultColumnList) nodeFactory.getNode(
                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                        getContextManager());
                fkRcl.addElement(
                                        (ResultColumn) nodeFactory.getNode(
                                                                        C_NodeTypes.RESULT_COLUMN,
                                                                        columnName,
                                                                        null,
                                                                        getContextManager())
                                );
                tcdn = (ConstraintDefinitionNode) nodeFactory.getNode(
                                                C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE,
                                                constraintName,
                                                referencedTable,
                                                fkRcl,
                                                refRcl,
                                                refActions,
                                                getContextManager());
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
      break;
    case CHECK:
      tcdn = checkConstraintDefinition(constraintName, columnName);
View Full Code Here

    throw new Error("Missing return statement in function");
  }

  final public TableElementNode tableConstraintDefinition() throws ParseException, StandardException {
        Properties properties = null;
        ConstraintDefinitionNode tcdn;
        TableName               constraintName = null;
        //initialize following two booleans before handling table level constraints
        explicitNotNull = false;
        explicitNull = false;
    switch (jj_nt.kind) {
    case CONSTRAINT:
      constraintName = constraintNameDefinition();
      break;
    default:
      jj_la1[276] = jj_gen;
      ;
    }
    tcdn = tableConstraint(constraintName);
    switch (jj_nt.kind) {
    case DERBYDASHPROPERTIES:
      properties = propertyList(false);
      jj_consume_token(CHECK_PROPERTIES);
      break;
    default:
      jj_la1[277] = jj_gen;
      ;
    }
                if (properties != null)
                {
                        tcdn.setProperties(properties);
                }
                {if (true) return tcdn;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.impl.sql.compile.ConstraintDefinitionNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.