Examples of ForeignKeyConstraintDescriptor


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

      ** constraint.
      */
      if (!skipFKs &&
        (cd instanceof ReferencedKeyConstraintDescriptor))
      {
        ForeignKeyConstraintDescriptor fkcd;
        ReferencedKeyConstraintDescriptor refcd;
        ConstraintDescriptorList fkcdl;
 
        refcd = (ReferencedKeyConstraintDescriptor)cd;
        fkcdl = refcd.getForeignKeyConstraints(ReferencedKeyConstraintDescriptor.ALL);

        int fkcdlSize = fkcdl.size();
        for (int inner = 0; inner < fkcdlSize; inner++)
        {
          fkcd = (ForeignKeyConstraintDescriptor) fkcdl.elementAt(inner)
          if (enable && !fkcd.isEnabled())
          {
            dm.invalidateFor(fkcd.getTableDescriptor(),
                  DependencyManager.SET_CONSTRAINTS_ENABLE, lcc);
            validateFKConstraint(fkcd, dd, tc, lcc.getContextManager());
            fkcd.setEnabled();
            dd.updateConstraintDescriptor(fkcd,
                fkcd.getUUID(),
                enabledCol,
                tc);
          }
          else if (!enable && fkcd.isEnabled())
          {
            dm.invalidateFor(fkcd, DependencyManager.SET_CONSTRAINTS_DISABLE,
                     lcc);
            fkcd.setDisabled();
            dd.updateConstraintDescriptor(fkcd,
                fkcd.getUUID(),
                enabledCol,
                tc);
          }
        }
      }
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

    String                  raDeleteRule="N";
    String          raUpdateRule="N";

    if (td != null)
    {
      ForeignKeyConstraintDescriptor cd = (ForeignKeyConstraintDescriptor)td;
      constraintId = cd.getUUID().toString();
     
      ReferencedKeyConstraintDescriptor refCd = cd.getReferencedConstraint();
      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(refCd != null, "this fk returned a null referenced key");
      }
      keyConstraintId = refCd.getUUID().toString();
      conglomId = cd.getIndexUUIDString();

      raDeleteRule = getRefActionAsString(cd.getRaDeleteRule());
      raUpdateRule = getRefActionAsString(cd.getRaUpdateRule());
    }
     
     
    /* Build the row  */
    row = getExecutionFactory().getIndexableRow(SYSFOREIGNKEYS_COLUMN_COUNT);
View Full Code Here

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

    String                  raDeleteRule="N";
    String          raUpdateRule="N";

    if (td != null)
    {
      ForeignKeyConstraintDescriptor cd = (ForeignKeyConstraintDescriptor)td;
      constraintId = cd.getUUID().toString();
     
      ReferencedKeyConstraintDescriptor refCd = cd.getReferencedConstraint();
      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(refCd != null, "this fk returned a null referenced key");
      }
      keyConstraintId = refCd.getUUID().toString();
      conglomId = cd.getIndexUUIDString();

      raDeleteRule = getRefActionAsString(cd.getRaDeleteRule());
      raUpdateRule = getRefActionAsString(cd.getRaUpdateRule());
    }
     
     
    /* Build the row  */
    row = getExecutionFactory().getIndexableRow(SYSFOREIGNKEYS_COLUMN_COUNT);
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
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.