Package org.apache.derby.iapi.sql.depend

Examples of org.apache.derby.iapi.sql.depend.DependencyManager


  public void drop(LanguageConnectionContext lcc,
          TableDescriptor td)
  throws StandardException
  {    
        DataDictionary dd = getDataDictionary();
        DependencyManager dm = dd.getDependencyManager();
        TransactionController tc = lcc.getTransactionExecute();
       
        // invalidate any prepared statements that
        // depended on the index (including this one)
        dm.invalidateFor(this, DependencyManager.DROP_INDEX, lcc);
     
        // only drop the conglomerate if no similar index but with different
      // name. Get from dd in case we drop other dup indexes with a cascade operation     
      if (dd.getConglomerateDescriptors(getConglomerateNumber()).length == 1)
      {
View Full Code Here


        // thrown, indicating that the DDL modification should be
        // rejected because a view is dependent on the underlying
        // object (table, column, privilege, etc.)
        default:

        DependencyManager dm;

        dm = getDataDictionary().getDependencyManager();
        throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_VIEW,
          dm.getActionString(action),
          p.getObjectName(), viewName);

    // end switch
  }
View Full Code Here

  public void drop(LanguageConnectionContext lcc,
                SchemaDescriptor sd, TableDescriptor td)
    throws StandardException
  {
        DataDictionary dd = getDataDictionary();
        DependencyManager dm = dd.getDependencyManager();
        TransactionController tc = lcc.getTransactionExecute();
       
    /* Drop the columns */
    dd.dropAllColumnDescriptors(td.getUUID(), tc);

    /* Prepare all dependents to invalidate.  (This is there chance
     * to say that they can't be invalidated.  For example, an open
     * cursor referencing a table/view that the user is attempting to
     * drop.) If no one objects, then invalidate any dependent objects.
     */
    dm.invalidateFor(td, DependencyManager.DROP_VIEW, lcc);

    /* Clear the dependencies for the view */
    dm.clearDependencies(lcc, this);

    /* Drop the view */
    dd.dropViewDescriptor(this, tc);

    /* Drop all table and column permission descriptors */
 
View Full Code Here

    private void dropAllDeclaredGlobalTempTables() throws StandardException
    {
        if (allDeclaredGlobalTempTables == null)
            return;
   
        DependencyManager dm = getDataDictionary().getDependencyManager();
        StandardException topLevelStandardException = null;

        // collect all the exceptions we might receive while dropping the
        // temporary tables and throw them as one chained exception at the end.
        for (int i = 0; i < allDeclaredGlobalTempTables.size(); i++)
        {
            try
            {
                TempTableInfo tempTableInfo =
                    (TempTableInfo)allDeclaredGlobalTempTables.get(i);

                TableDescriptor td = tempTableInfo.getTableDescriptor();

                // the following 2 lines of code has been copied from
                // DropTableConstantAction. If there are any changes made there
                // in future, we should check if they need to be made here too.
                dm.invalidateFor(td, DependencyManager.DROP_TABLE, this);
                tran.dropConglomerate(td.getHeapConglomerateId());

            }
            catch (StandardException e)
            {
View Full Code Here

                /* is there an open result set? */
                if (rs != null && ! rs.isClosed())
                {
                    if ((provider != null) && rs.returnsRows()) {
                    DependencyManager dmgr = getDataDictionary().getDependencyManager();

                    throw StandardException.newException(SQLState.LANG_CANT_INVALIDATE_OPEN_RESULT_SET,
                                    dmgr.getActionString(action),
                                    provider.getObjectName());

                    }
                    return true;
                }
View Full Code Here

    }

    /* Clean up any dependencies */
    if (dependencies != null)
    {
      DependencyManager dmgr = lcc.getDataDictionary().getDependencyManager();

      for (Iterator iterator = dependencies.iterator(); iterator.hasNext(); )
      {
        Dependency dy = (Dependency) iterator.next();
        dmgr.clearInMemoryDependency(dy);
      }

      dependencies = null;
    }

View Full Code Here

      compilingStatement = true;
    }

    try {

      DependencyManager dm = lcc.getDataDictionary().getDependencyManager();

      /* Clear out the old dependencies on this statement as we
       * will build the new set during the reprepare in makeValid().
       */
      dm.clearDependencies(lcc, this);

      /*
      ** If we are invalidating an EXECUTE STATEMENT because of a stale
      ** plan, we also need to invalidate the stored prepared statement.
      */
 
View Full Code Here

        case DependencyManager.DROP_TABLE:
        case DependencyManager.DROP_SYNONYM:
        case DependencyManager.DROP_SPS:
        case DependencyManager.RENAME:
        case DependencyManager.REVOKE_PRIVILEGE_RESTRICT:
        DependencyManager dm = getDataDictionary().getDependencyManager();
        throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
                  dm.getActionString(action),
                  p.getObjectName(), "TRIGGER", name);

        /*
      ** The trigger descriptor depends on the trigger table.
      ** This means that we get called whenever anything happens
View Full Code Here

    switch (action)
    {
      // invalidate this trigger descriptor
      case DependencyManager.USER_RECOMPILE_REQUEST:
        DependencyManager dm = getDataDictionary().getDependencyManager();
        dm.invalidateFor(this, DependencyManager.PREPARED_STATEMENT_RELEASE, lcc);
        break;

      // When REVOKE_PRIVILEGE gets sent (this happens for privilege
      // types SELECT, UPDATE, DELETE, INSERT, REFERENCES, TRIGGER), we 
      // make the TriggerDescriptor drop itself.
View Full Code Here

  }
   
    public void drop(LanguageConnectionContext   lcc) throws StandardException
    {
        DataDictionary dd = getDataDictionary();
        DependencyManager dm = getDataDictionary().getDependencyManager();
        TransactionController tc = lcc.getTransactionExecute();
        dm.invalidateFor(this, DependencyManager.DROP_TRIGGER, lcc);

        // Drop the trigger
        dd.dropTriggerDescriptor(this, tc);

        // Clear the dependencies for the trigger
        dm.clearDependencies(lcc, this);

        // Drop the spses
        SPSDescriptor spsd = dd.getSPSDescriptor(this.getActionId());

        // there shouldn't be any dependencies, but in case
        // there are, lets clear them
        dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc);
        dm.clearDependencies(lcc, spsd);
        dd.dropSPSDescriptor(spsd, tc);
       
        if (getWhenClauseId() != null)
        {  
            spsd = dd.getSPSDescriptor(getWhenClauseId());
            dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc);
            dm.clearDependencies(lcc, spsd);
            dd.dropSPSDescriptor(spsd, tc);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.depend.DependencyManager

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.