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

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


   */
  public final synchronized void makeInvalid(int action,
                         LanguageConnectionContext lcc)
    throws StandardException
  {
    DependencyManager dm;

    dm = getDataDictionary().getDependencyManager();

    switch (action)
    {
      /*
      ** Some things that don't affect stored prepared
       ** statements.
      */
      case DependencyManager.PREPARED_STATEMENT_RELEASE:
        case DependencyManager.CREATE_VIEW:
        break;

      /*
       ** Things that can invalidate a stored
      ** prepared statement.
      */
      case DependencyManager.CREATE_INDEX:
      case DependencyManager.CREATE_CONSTRAINT:
      case DependencyManager.DROP_CONSTRAINT:
      case DependencyManager.DROP_TABLE:
      case DependencyManager.DROP_INDEX:
      case DependencyManager.DROP_VIEW:
      case DependencyManager.DROP_METHOD_ALIAS:
      case DependencyManager.DROP_SYNONYM:
      case DependencyManager.ALTER_TABLE:
      case DependencyManager.RENAME:
      case DependencyManager.RENAME_INDEX:
      case DependencyManager.USER_RECOMPILE_REQUEST:
      case DependencyManager.CHANGED_CURSOR:
      case DependencyManager.BULK_INSERT:
      case DependencyManager.COMPRESS_TABLE:
      case DependencyManager.SET_CONSTRAINTS_ENABLE:
      case DependencyManager.SET_CONSTRAINTS_DISABLE:
      case DependencyManager.SET_TRIGGERS_ENABLE:
      case DependencyManager.SET_TRIGGERS_DISABLE:
      case DependencyManager.ROLLBACK:
      case DependencyManager.INTERNAL_RECOMPILE_REQUEST:
      case DependencyManager.CREATE_TRIGGER:
      case DependencyManager.DROP_TRIGGER:
      case DependencyManager.DROP_COLUMN:
        case DependencyManager.UPDATE_STATISTICS:
        case DependencyManager.DROP_STATISTICS:
      case DependencyManager.TRUNCATE_TABLE:
        /*
        ** If we are already invalid, don't write ourselves
        ** out.  Just to be safe, we'll send out an invalidate
        ** to our dependents either way.
        */
        if (valid == true)
        {
          valid = false;
          updateSYSSTATEMENTS(lcc, INVALIDATE, null);
        }
        dm.invalidateFor(this, dm.USER_RECOMPILE_REQUEST, lcc);
        break;
      case DependencyManager.DROP_SPS:
        //System.out.println("SPSD " + preparedStatement);
        dm.clearDependencies(lcc, this);
        break;
 
        default:

        /*
        ** We should never get here, since we can't have dangling references
        */
        if (SanityManager.DEBUG)
        {
          SanityManager.THROWASSERT("makeInvalid("+
            dm.getActionString(action)+
            ") not expected to get called; should have failed in "+
            "prepareToInvalidate()");
        }
        break;

View Full Code Here


   */
  public void prepareToInvalidate(Provider p, int action,
          LanguageConnectionContext lcc)
    throws StandardException
  {
    DependencyManager dm = getDataDictionary().getDependencyManager();

    switch (action)
    {
      /*
      ** A SET CONSTRAINT stmt will throw an SET_CONSTRAINTS action
      ** when enabling/disabling constraints.  We'll ignore it.
      ** Same for SET TRIGGERS
      */
        case DependencyManager.SET_CONSTRAINTS_ENABLE:
        case DependencyManager.SET_CONSTRAINTS_DISABLE:
        case DependencyManager.SET_TRIGGERS_ENABLE:
        case DependencyManager.SET_TRIGGERS_DISABLE:
      //When REVOKE_PRIVILEGE gets sent (this happens for privilege
      //types SELECT, UPDATE, DELETE, INSERT, REFERENCES, TRIGGER), we 
      //don't do anything here. Later in makeInvalid method, we make 
      //the ConstraintDescriptor drop itself.
        case DependencyManager.REVOKE_PRIVILEGE:
        break;

      /*
      ** Currently, the only thing we are depenedent
      ** on is another constraint or an alias..
      */
      //Notice that REVOKE_PRIVILEGE_RESTRICT is not caught earlier.
        //It gets handled in this default: action where an exception
        //will be thrown. This is because, if such an invalidation
        //action type is ever received by a dependent, the dependent
        //should throw an exception.
      //In Derby, at this point, REVOKE_PRIVILEGE_RESTRICT gets sent
        //when execute privilege on a routine is getting revoked.
        //Currently, in Derby, a constraint can't depend on a routine
        //and hence a REVOKE_PRIVILEGE_RESTRICT invalidation action
        //should never be received by a ConstraintDescriptor. But this
        //may change in future and when it does, the code to do the right
        //thing is already here.
        default:
        throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
                  dm.getActionString(action),
                  p.getObjectName(), "CONSTRAINT", constraintName);
    }
  }
View Full Code Here

      ** We should never get here, we should have barfed on
      ** prepareToInvalidate().
      */
      if (SanityManager.DEBUG)
      {
        DependencyManager dm;
   
        dm = getDataDictionary().getDependencyManager();
 
        SanityManager.THROWASSERT("makeInvalid("+
          dm.getActionString(action)+
          ") not expected to get called");
      }
    }
  }
View Full Code Here

        //show throw an exception.
      //In Derby, at this point, REVOKE_PRIVILEGE_RESTRICT gets sent
        //when execute privilege on a routine is getting revoked.
        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

        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 static String countDependencies() throws StandardException, java.sql.SQLException
  {
    int            numDependencies = 0;
    DataDictionary      dd;
    DataDictionaryContext  ddc;
    DependencyManager    dm;
    StringBuffer      debugBuf = new StringBuffer();

    ddc = (DataDictionaryContext)
        (ContextService.getContext(DataDictionaryContext.CONTEXT_ID));

    dd = ddc.getDataDictionary();
    dm = dd.getDependencyManager();

    numDependencies = dm.countDependencies();

    if (numDependencies > 0)
    {
            debugBuf.append(numDependencies + " dependencies found");
    }
View Full Code Here

  public static String countDependencies() throws StandardException, java.sql.SQLException
  {
    int            numDependencies = 0;
    DataDictionary      dd;
    DataDictionaryContext  ddc;
    DependencyManager    dm;
    StringBuffer      debugBuf = new StringBuffer();

    ddc = (DataDictionaryContext)
        (ContextService.getContext(DataDictionaryContext.CONTEXT_ID));

    dd = ddc.getDataDictionary();
    dm = dd.getDependencyManager();

    numDependencies = dm.countDependencies();

    if (numDependencies > 0)
    {
      debugBuf.append(numDependencies + " dependencies found");
    }
View Full Code Here

   */
  public void prepareToInvalidate(Provider p, int action,
          LanguageConnectionContext lcc)
    throws StandardException
  {
    DependencyManager dm = getDataDictionary().getDependencyManager();

    switch (action)
    {
      /*
      ** Currently, the only thing we are depenedent
      ** on is an alias.
      */
        default:
        DataDictionary dd = getDataDictionary();
        ColumnDescriptor cd = dd.getColumnDescriptorByDefaultId(defaultUUID);
        TableDescriptor td = dd.getTableDescriptor(cd.getReferencingUUID());

        throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
                  dm.getActionString(action),
                  p.getObjectName(),
                  MessageService.getTextMessage(
                    SQLState.LANG_COLUMN_DEFAULT
                  ),
                  td.getQualifiedName() + "." +
View Full Code Here

    ** We should never get here, we should have barfed on
    ** prepareToInvalidate().
    */
    if (SanityManager.DEBUG)
    {
      DependencyManager dm;
 
      dm = getDataDictionary().getDependencyManager();

      SanityManager.THROWASSERT("makeInvalid("+
        dm.getActionString(action)+
        ") not expected to get called");
    }
  }
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.