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

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


      ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);
    startWriting(lcc);

    for (java.util.Iterator li = getAllSPSDescriptors().iterator(); li.hasNext(); )
    {
      SPSDescriptor spsd = (SPSDescriptor) li.next();
      spsd.makeInvalid(DependencyManager.USER_RECOMPILE_REQUEST, lcc);
    }
  }
View Full Code Here


   
    while (e.hasMoreElements())
    {
      String spsName = (String)e.nextElement();
      String spsText =  p.getProperty(spsName);
      SPSDescriptor spsd = new SPSDescriptor(this, spsName,
                           getUUIDFactory().createUUID(),
                           schemaID,
                           schemaID,
                           SPSDescriptor.SPS_TYPE_REGULAR,
                           !nocompile,    // it is valid, unless nocompile
View Full Code Here

   */
  private void dropJDBCMetadataSPSes(TransactionController tc) throws StandardException
  {
    for (java.util.Iterator it = getAllSPSDescriptors().iterator(); it.hasNext(); )
    {
      SPSDescriptor spsd = (SPSDescriptor) it.next();
      SchemaDescriptor sd = spsd.getSchemaDescriptor();

      // don't drop statements in non-system schemas
      if (!sd.isSystemSchema()) {
        continue;
      }

      dropSPSDescriptor(spsd, tc);
      dropDependentsStoredDependencies(spsd.getUUID(),                                                                                                              tc);

    }
  }
View Full Code Here

     * entry.  Don't want to block.
     */
    lcc.beginNestedTransaction(true);

    DataDictionary dd = getLanguageConnectionContext().getDataDictionary();
    SPSDescriptor spsd = dd.getSPSDescriptor(
                    spsName,
                    net ? dd.getSysIBMSchemaDescriptor() :
                    dd.getSystemSchemaDescriptor());
    lcc.commitNestedTransaction();

View Full Code Here

      //    AFTER UPDATE OF c12
      //    ON DERBY4998_SOFT_UPGRADE_RESTRICT REFERENCING OLD AS oldt
      //    FOR EACH ROW
      //    SELECT oldt.c11 from DERBY4998_SOFT_UPGRADE_RESTRICT

      SPSDescriptor triggerActionSPSD = trd.getActionSPS(lcc);
      int[] referencedColsInTriggerAction = new int[td.getNumberOfColumns()];
      java.util.Arrays.fill(referencedColsInTriggerAction, -1);
      triggerActionSPSD.setText(dd.getTriggerActionString(stmtnode,
        trd.getOldReferencingName(),
        trd.getNewReferencingName(),
        trd.getTriggerDefinition(),
        trd.getReferencedCols(),
        referencedColsInTriggerAction,
        0,
        trd.getTableDescriptor(),
        trd.getTriggerEventMask(),
        true
        ));
     
      // Now that we have the internal format of the trigger action sql,
      // bind that sql to make sure that we are not using colunm being
      // dropped in the trigger action sql directly (ie not through
      // REFERENCING clause.
      // eg
      // create table atdc_12 (a integer, b integer);
      // create trigger atdc_12_trigger_1 after update of a
      //     on atdc_12 for each row select a,b from atdc_12
      // Drop one of the columns used in the trigger action
      //   alter table atdc_12 drop column b
      // Following rebinding of the trigger action sql will catch the use
      // of column b in trigger atdc_12_trigger_1
      compSchema = dd.getSchemaDescriptor(trd.getSchemaDescriptor().getUUID(), null);
      newCC = lcc.pushCompilerContext(compSchema);
        newCC.setReliability(CompilerContext.INTERNAL_SQL_LEGAL);
      pa = newCC.getParser();
      stmtnode = (StatementNode)pa.parseStatement(triggerActionSPSD.getText());
      // need a current dependent for bind
      newCC.setCurrentDependent(triggerActionSPSD.getPreparedStatement());
      stmtnode.bindStatement();
    } catch (StandardException se)
    {
      //Need to catch for few different kinds of sql states depending
      // on what kind of trigger action sql is using the column being
View Full Code Here

          ** the SPP to invalidate it.
          */
          DataDictionary dd = lcc.getDataDictionary();
           
          SchemaDescriptor sd = dd.getSchemaDescriptor(execSchemaName, lcc.getTransactionCompile(), true);
          SPSDescriptor spsd = dd.getSPSDescriptor(execStmtName, sd);
          spsd.makeInvalid(action, lcc);
          break;
        }
        }
      }
    } finally {
View Full Code Here

   * @exception StandardException    Thrown on failure
   */
  public void  executeConstantAction(Activation activation)
            throws StandardException
  {
    SPSDescriptor        whenspsd = null;
    SPSDescriptor        actionspsd;

    LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
    DataDictionary dd = lcc.getDataDictionary();
    DependencyManager dm = dd.getDependencyManager();
    TransactionController tc = lcc.getTransactionExecute();
View Full Code Here

    */
    String spsName = "TRIGGER" +
            (isWhen ? "WHEN_" : "ACTN_") +
            triggerId + "_" + triggerTable.getUUID().toString();

    SPSDescriptor spsd = new SPSDescriptor(dd, spsName,
                  (spsId == null) ?
                    dd.getUUIDFactory().createUUID() :
                    spsId,
                  sd.getUUID(),
                  compSchemaId == null ?
                    lcc.getDefaultSchema().getUUID() :
                    compSchemaId,
                  SPSDescriptor.SPS_TYPE_TRIGGER,
                  true,        // it is valid
                  text,        // the text
                  true )// no defaults

    /*
    ** Prepared the stored prepared statement
    ** and release the activation class -- we
    ** know we aren't going to execute statement
    ** after create it, so for now we are finished.
    */
    spsd.prepareAndRelease(lcc, triggerTable);


    dd.addSPSDescriptor(spsd, tc);

    return spsd;
View Full Code Here

          ** the SPP to invalidate it.
          */
          DataDictionary dd = lcc.getDataDictionary();
           
          SchemaDescriptor sd = dd.getSchemaDescriptor(execSchemaName, lcc.getTransactionCompile(), true);
          SPSDescriptor spsd = dd.getSPSDescriptor(execStmtName, sd);
          spsd.makeInvalid(action, lcc);
          break;
        }
        }
      }
    } finally {
View Full Code Here

   * @exception StandardException    Thrown on failure
   */
  public SPSDescriptor getSPSDescriptor(UUID uuid)
        throws StandardException
  {
    SPSDescriptor     sps;

    /* Make sure that non-core info is initialized */
    getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);

    /* Only use the cache if we're in compile-only mode */
    if ((spsNameCache != null) &&
      (getCacheMode() == DataDictionary.COMPILE_ONLY_MODE))
    {
      sps = spsIdHash.get(uuid);
      if (sps != null)
      {
        //System.out.println("found in hash table ");
        // System.out.println("stmt text " + sps.getText());

        return sps;
      }
 
      sps = getSPSDescriptorIndex2Scan(uuid.toString());
      TableKey stmtKey = new TableKey(sps.getSchemaDescriptor().getUUID(), sps.getName());
      try
      {
        SPSNameCacheable   cacheEntry = (SPSNameCacheable)spsNameCache.create(stmtKey, sps);
        spsNameCache.release(cacheEntry);
      } catch (StandardException se)
View Full Code Here

TOP

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

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.