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

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


        //    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();
        //Register the dependency between trigger table and trigger
        // action SPS
        dm.addDependency(triggerActionSPSD, td, lcc.getContextManager());
      } catch (StandardException se)
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

      */
      dd.startWriting(lcc);

      for (java.util.ListIterator li = dd.getAllSPSDescriptors().listIterator(); li.hasNext(); )
      {
        SPSDescriptor spsd = (SPSDescriptor) li.next();

        /*
        ** Is it in SYS? if so, zap it. Can't drop metadata SPS in SYSIBM, JCC depends on it.
        */
        if (spsd.getSchemaDescriptor().isSystemSchema() && !spsd.getSchemaDescriptor().isSYSIBM())
        {
          dd.dropSPSDescriptor(spsd, tc);
          dd.dropDependentsStoredDependencies(spsd.getUUID(), tc);
        }
      }
    } catch (StandardException se)
    {
      throw PublicAPI.wrapStandardException(se);
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 = (SPSDescriptor)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

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

    SPSDescriptor spsd = (SPSDescriptor)
          getDescriptorViaIndex(
            SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
View Full Code Here

   * @exception StandardException    Thrown on failure
   */
  public SPSDescriptor getSPSDescriptor(String stmtName, SchemaDescriptor sd)
    throws StandardException
  {
    SPSDescriptor    sps = null;
    TableKey      stmtKey;
    UUID        schemaUUID;

    /*
    ** If we didn't get a schema descriptor, we had better
View Full Code Here

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

    SPSDescriptor spsd = (SPSDescriptor)
          getDescriptorViaIndex(
            SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX2_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
            (TupleDescriptor) null,
            (List) null,
            false);
 
    /*
    ** Set up the parameter defaults.  We are only
    ** doing this when we look up by name because
    ** this is the only time we cache, and it can
    ** be foolish to look up the parameter defaults
    ** for someone that doesn't need them.
    */
    if (spsd != null)
    {
      Vector v = new Vector();
      spsd.setParams(getSPSParams(spsd, v));
      Object[] defaults = new Object[v.size()];
      v.copyInto(defaults);
      spsd.setParameterDefaults(defaults);
    }

    return spsd;
  }
View Full Code Here

      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

   * @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 = (SPSDescriptor)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.