Examples of ForeignKeyConstraintDescriptor


Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

    */
        conDesc.drop(lcc, !cascadeOnRefKey);

    if (cascadeOnRefKey)
    {
      ForeignKeyConstraintDescriptor fkcd;
      ReferencedKeyConstraintDescriptor cd;
      ConstraintDescriptorList cdl;

      cd = (ReferencedKeyConstraintDescriptor)conDesc;
      cdl = cd.getForeignKeyConstraints(ReferencedKeyConstraintDescriptor.ALL);
      int cdlSize = cdl.size();

      for(int index = 0; index < cdlSize; index++)
      {
        fkcd = (ForeignKeyConstraintDescriptor) cdl.elementAt(index);
        dm.invalidateFor(fkcd, DependencyManager.DROP_CONSTRAINT, lcc);
        fkcd.drop(lcc, true);
      }
 
      /*
      ** We told dropConstraintAndIndex not to
      ** remove our dependencies, so send an invalidate,
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

    ** all others get a row in SYSKEYS.
    */
    if (descriptor.getConstraintType()
        == DataDictionary.FOREIGNKEY_CONSTRAINT)
    {
      ForeignKeyConstraintDescriptor fkDescriptor =
          (ForeignKeyConstraintDescriptor)descriptor;

      if (SanityManager.DEBUG)
      {
        if (!(descriptor instanceof ForeignKeyConstraintDescriptor))
        {
          SanityManager.THROWASSERT("descriptor not an fk descriptor, is "+
            descriptor.getClass().getName());
        }
      }
     
      ti = getNonCoreTI(SYSFOREIGNKEYS_CATALOG_NUM);
      SYSFOREIGNKEYSRowFactory fkkeysRF = (SYSFOREIGNKEYSRowFactory)ti.getCatalogRowFactory();

      row = fkkeysRF.makeRow(fkDescriptor, null);

      /*
      ** Now we need to bump the reference count of the
      ** contraint that this FK references
      */
      ReferencedKeyConstraintDescriptor refDescriptor =
              fkDescriptor.getReferencedConstraint();

      refDescriptor.incrementReferenceCount();

      int[] colsToSet = new int[1];
      colsToSet[0] = SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_REFERENCECOUNT;
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

        uuids = new UUID[size];
        fkNames = new String[size];
        conglomNumbers = new long[size];
        isSelfReferencingFK = new boolean[size];
        raRules = new int[size];
        ForeignKeyConstraintDescriptor fkcd = null;
        TableDescriptor fktd;
        ColumnDescriptorList coldl;
        int[] refColumns;
        ColumnDescriptor cold;
        int[] colArray = remapReferencedColumns(cd, rowMap);
        for (int inner = 0; inner < size; inner++)
        {
          fkcd = (ForeignKeyConstraintDescriptor) fkcdl.elementAt(inner);
          fkSetupArrays(dd, fkcd,
                inner, uuids, conglomNumbers, fkNames,
                isSelfReferencingFK, raRules);
          if((raRules[inner] == StatementType.RA_CASCADE) ||
             (raRules[inner] ==StatementType.RA_SETNULL))
          {
            //find  the referencing  table Name
            fktd = fkcd.getTableDescriptor();
            refTableNames.add(fktd.getSchemaName() + "." + fktd.getName());
            refActions.add(new Integer(raRules[inner]));
            //find the referencing column name required for update null.
            refColumns = fkcd.getReferencedColumns();
            coldl = fktd.getColumnDescriptorList();
            ColumnDescriptorList releventColDes = new ColumnDescriptorList();
            for(int i = 0 ; i < refColumns.length; i++)
            {
              cold =(ColumnDescriptor)coldl.elementAt(refColumns[i]-1);
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

          }
        }
      }
      else if (cd instanceof ForeignKeyConstraintDescriptor)
      {
        ForeignKeyConstraintDescriptor fkcd = (ForeignKeyConstraintDescriptor) cd;
        if (dependent == null)
        {
          compilerContext.createDependency(fkcd.getReferencedConstraint().getTableDescriptor());
        }
        else
        {
          compilerContext.createDependency(dependent,
                  fkcd.getReferencedConstraint().getTableDescriptor());
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

    ** all others get a row in SYSKEYS.
    */
    if (descriptor.getConstraintType()
        == DataDictionary.FOREIGNKEY_CONSTRAINT)
    {
      ForeignKeyConstraintDescriptor fkDescriptor =
          (ForeignKeyConstraintDescriptor)descriptor;

      if (SanityManager.DEBUG)
      {
        if (!(descriptor instanceof ForeignKeyConstraintDescriptor))
        {
          SanityManager.THROWASSERT("descriptor not an fk descriptor, is "+
            descriptor.getClass().getName());
        }
      }
     
      ti = getNonCoreTI(SYSFOREIGNKEYS_CATALOG_NUM);
      SYSFOREIGNKEYSRowFactory fkkeysRF = (SYSFOREIGNKEYSRowFactory)ti.getCatalogRowFactory();

      row = fkkeysRF.makeRow(fkDescriptor, null);

      /*
      ** Now we need to bump the reference count of the
      ** contraint that this FK references
      */
      ReferencedKeyConstraintDescriptor refDescriptor =
              fkDescriptor.getReferencedConstraint();

      refDescriptor.incrementReferenceCount();

      int[] colsToSet = new int[1];
      colsToSet[0] = SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_REFERENCECOUNT;
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

        uuids = new UUID[size];
        fkNames = new String[size];
        conglomNumbers = new long[size];
        isSelfReferencingFK = new boolean[size];
        raRules = new int[size];
        ForeignKeyConstraintDescriptor fkcd = null;
        TableDescriptor fktd;
        ColumnDescriptorList coldl;
        int[] refColumns;
        ColumnDescriptor cold;
        int[] colArray = remapReferencedColumns(cd, rowMap);
        for (int inner = 0; inner < size; inner++)
        {
          fkcd = (ForeignKeyConstraintDescriptor) fkcdl.elementAt(inner);
          fkSetupArrays(dd, fkcd,
                inner, uuids, conglomNumbers, fkNames,
                isSelfReferencingFK, raRules);
          if((raRules[inner] == StatementType.RA_CASCADE) ||
             (raRules[inner] ==StatementType.RA_SETNULL))
          {
            //find  the referencing  table Name
            fktd = fkcd.getTableDescriptor();
            refTableNames.addElement(fktd.getSchemaName() + "." + fktd.getName());
            refActions.addElement(new Integer(raRules[inner]));
            //find the referencing column name required for update null.
            refColumns = fkcd.getReferencedColumns();
            coldl = fktd.getColumnDescriptorList();
            ColumnDescriptorList releventColDes = new ColumnDescriptorList();
            for(int i = 0 ; i < refColumns.length; i++)
            {
              cold =(ColumnDescriptor)coldl.elementAt(refColumns[i]-1);
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

          }
        }
      }
      else if (cd instanceof ForeignKeyConstraintDescriptor)
      {
        ForeignKeyConstraintDescriptor fkcd = (ForeignKeyConstraintDescriptor) cd;
        if (dependent == null)
        {
          compilerContext.createDependency(fkcd.getReferencedConstraint().getTableDescriptor());
        }
        else
        {
          compilerContext.createDependency(dependent,
                  fkcd.getReferencedConstraint().getTableDescriptor());
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

        uuids = new UUID[size];
        fkNames = new String[size];
        conglomNumbers = new long[size];
        isSelfReferencingFK = new boolean[size];
        raRules = new int[size];
        ForeignKeyConstraintDescriptor fkcd = null;
        TableDescriptor fktd;
        ColumnDescriptorList coldl;
        int[] refColumns;
        ColumnDescriptor cold;
        int[] colArray = remapReferencedColumns(cd, rowMap);
        for (int inner = 0; inner < size; inner++)
        {
          fkcd = (ForeignKeyConstraintDescriptor) fkcdl.elementAt(inner);
          fkSetupArrays(dd, fkcd,
                inner, uuids, conglomNumbers, fkNames,
                isSelfReferencingFK, raRules);
          if((raRules[inner] == StatementType.RA_CASCADE) ||
             (raRules[inner] ==StatementType.RA_SETNULL))
          {
            //find  the referencing  table Name
            fktd = fkcd.getTableDescriptor();
            refTableNames.addElement(fktd.getSchemaName() + "." + fktd.getName());
            refActions.addElement(new Integer(raRules[inner]));
            //find the referencing column name required for update null.
            refColumns = fkcd.getReferencedColumns();
            coldl = fktd.getColumnDescriptorList();
            ColumnDescriptorList releventColDes = new ColumnDescriptorList();
            for(int i = 0 ; i < refColumns.length; i++)
            {
              cold =(ColumnDescriptor)coldl.elementAt(refColumns[i]-1);
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

          }
        }
      }
      else if (cd instanceof ForeignKeyConstraintDescriptor)
      {
        ForeignKeyConstraintDescriptor fkcd = (ForeignKeyConstraintDescriptor) cd;
        if (dependent == null)
        {
          compilerContext.createDependency(fkcd.getReferencedConstraint().getTableDescriptor());
        }
        else
        {
          compilerContext.createDependency(dependent,
                  fkcd.getReferencedConstraint().getTableDescriptor());
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.ForeignKeyConstraintDescriptor

    */
    dropConstraintAndIndex(dm, td, dd, conDesc, tc, lcc, !cascadeOnRefKey);

    if (cascadeOnRefKey)
    {
      ForeignKeyConstraintDescriptor fkcd;
      ReferencedKeyConstraintDescriptor cd;
      ConstraintDescriptorList cdl;

      cd = (ReferencedKeyConstraintDescriptor)conDesc;
      cdl = cd.getForeignKeyConstraints(ReferencedKeyConstraintDescriptor.ALL);
      int cdlSize = cdl.size();

      for(int index = 0; index < cdlSize; index++)
      {
        fkcd = (ForeignKeyConstraintDescriptor) cdl.elementAt(index);
        dm.invalidateFor(fkcd, DependencyManager.DROP_CONSTRAINT, lcc);
        dropConstraintAndIndex(dm, fkcd.getTableDescriptor(), dd, fkcd,
                tc, lcc, true);
      }
 
      /*
      ** We told dropConstraintAndIndex not to
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.