Package org.apache.derby.iapi.sql.dictionary

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


   */
  public void  dropAllConstraintDescriptors(TableDescriptor table,
                       TransactionController tc)
    throws StandardException
  {
    ConstraintDescriptorList cdl = getConstraintDescriptors(table);

    // Walk the table's CDL and drop each ConstraintDescriptor.
    for (Iterator iterator = cdl.iterator(); iterator.hasNext(); )
    {
      ConstraintDescriptor cd = (ConstraintDescriptor) iterator.next();
      dropConstraintDescriptor(cd, tc);
    }

View Full Code Here


   */
  protected boolean hasCheckConstraints(DataDictionary dd,
                      TableDescriptor td)
    throws StandardException
  {
    ConstraintDescriptorList cdl = dd.getConstraintDescriptors(td);
        if (cdl == null)
            return false;
    ConstraintDescriptorList ccCDL = cdl.getSubList(DataDictionary.CHECK_CONSTRAINT);

    return (ccCDL.size() > 0);
  }
View Full Code Here

    ConstraintDescriptorList  cdl,
    TableDescriptor        td
    )
    throws StandardException
  {
    ConstraintDescriptorList  ccCDL = cdl.getSubList(DataDictionary.CHECK_CONSTRAINT);
    int              ccCDLSize = ccCDL.size();
    ValueNode          checkTree = null;

    // Get the text of all the check constraints
    for (int index = 0; index < ccCDLSize; index++)
    {
      ConstraintDescriptor cd = ccCDL.elementAt(index);

      String constraintText = cd.getConstraintText();

      // Get the query tree for this constraint
      ValueNode oneConstraint =
View Full Code Here

    Vector                fkVector = new Vector(10);
    int                 type;
    UUID[]                 uuids = null;
    long[]                 conglomNumbers = null;
    String[]              fkNames = null;
    ConstraintDescriptorList      fkcdl;
    ReferencedKeyConstraintDescriptor  refcd;
    boolean[]              isSelfReferencingFK;
    ConstraintDescriptorList      activeList = dd.getActiveConstraintDescriptors(cdl);
    int[]                rowMap = getRowMap(readColsBitSet, td);
    int[]                               raRules = null;
    Vector                              refTableNames = new Vector(1);
    Vector                              refIndexConglomNum = new Vector(1);
    Vector                              refActions = new Vector(1);
    Vector                              refColDescriptors = new Vector(1);
    Vector                              fkColMap = new Vector(1);
    int activeSize = activeList.size();
    for (int index = 0; index < activeSize; index++)
    {
      ConstraintDescriptor cd = activeList.elementAt(index);

      if (cd instanceof ForeignKeyConstraintDescriptor)
      {
        /*
        ** We are saving information for checking the
View Full Code Here

      ** the index number will change, so we'll add a
      ** dependency on all tables we will scan.
      */
      if (cd instanceof ReferencedKeyConstraintDescriptor)
      { 
        ConstraintDescriptorList fkcdl = dd.getActiveConstraintDescriptors
          ( ((ReferencedKeyConstraintDescriptor)cd).getForeignKeyConstraints(ConstraintDescriptor.ENABLED) );
 
        int fklSize = fkcdl.size();
        for (int inner = 0; inner < fklSize; inner++)
        {
          ConstraintDescriptor fkcd = fkcdl.elementAt(inner);
          if (dependent == null)
          {
            compilerContext.createDependency(fkcd);
            compilerContext.createDependency(fkcd.getTableDescriptor());
          }
View Full Code Here

    throws StandardException
  {
    if ( relevantCdl != null ) { return relevantCdl; }

    boolean[]  needsDeferredProcessing = new boolean[1];
    relevantCdl = new ConstraintDescriptorList();

    needsDeferredProcessing[0] = requiresDeferredProcessing;
    td.getAllRelevantConstraints
      ( statementType, skipCheckConstraints, changedColumnIds,
        needsDeferredProcessing, relevantCdl );
View Full Code Here

                    Long.toString(indexRows),
                    Long.toString(baseRowCount));
        }
      }
      /* check that all constraints have backing index */
      ConstraintDescriptorList constraintDescList =
        dd.getConstraintDescriptors(td);
      for (int index = 0; index < constraintDescList.size(); index++)
      {
        constraintDesc = constraintDescList.elementAt(index);
        if (constraintDesc.hasBackingIndex())
        {
          ConglomerateDescriptor conglomDesc;

          conglomDesc = td.getConglomerateDescriptor(
View Full Code Here

  private ConstraintDescriptorList getAllConstraintDescriptors()
    throws StandardException
  {
    TabInfoImpl          ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);

    ConstraintDescriptorList list = new ConstraintDescriptorList();

    getConstraintDescriptorViaHeap(
            (ScanQualifier[][]) null,
            ti,
            (TupleDescriptor) null,
View Full Code Here

   * @exception StandardException    Thrown on failure
   */
  public ConstraintDescriptorList getConstraintDescriptors(TableDescriptor td)
    throws StandardException
  {
    ConstraintDescriptorList  cdl;

    if (td == null)
    {
      return getAllConstraintDescriptors();
    }

    /* RESOLVE - need to look at multi-user aspects of hanging constraint
     * descriptor list off of table descriptor when we restore the cache.
     */

    /* Build the TableDescriptor's CDL if it is currently empty */
    cdl = td.getConstraintDescriptorList();

    /*
    ** Synchronize the building of the CDL.  The CDL itself is created
    ** empty when the TD is created, so there is no need to synchronize
    ** the getting of the CDL.
    */
    synchronized(cdl)
    {
      if (! cdl.getScanned())
      {
        getConstraintDescriptorsScan(td, false);
      }
    }

View Full Code Here

   * @exception StandardException    Thrown on failure
   */
   private void getConstraintDescriptorsScan(TableDescriptor td, boolean forUpdate)
      throws StandardException
  {
    ConstraintDescriptorList  cdl = td.getConstraintDescriptorList();
    DataValueDescriptor      tableIDOrderable = null;
    TabInfoImpl            ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);

    /* Use tableIDOrderable in both start and stop positions for scan */
    tableIDOrderable = getValueAsDVD(td.getUUID());

    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);

    keyRow.setColumn(1, tableIDOrderable);

    getConstraintDescriptorViaIndex(
          SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX3_ID,
          keyRow,
          ti,
          td,
          cdl,
          forUpdate);
    cdl.setScanned(true);
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList

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.