Examples of ViewDescriptor


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

          FormatableBitSet providingCols = td.getReferencedColumnMap();
          if (providingCols == null)
          {
            if (dep instanceof ViewDescriptor)
            {
              ViewDescriptor vd = (ViewDescriptor) dep;
              SchemaDescriptor compSchema;
              compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
              CompilerContext newCC = lcc.pushCompilerContext(compSchema);
              Parser  pa = newCC.getParser();

              // Since this is always nested inside another SQL
              // statement, so topLevel flag should be false
              CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
                        vd.getViewText());

              // need a current dependent for bind
              newCC.setCurrentDependent(dep);
              cvn.bindStatement();
              ProviderInfo[] providerInfos = cvn.getProviderInfo();
View Full Code Here

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

            TableDescriptor t = (TableDescriptor)p;
            s = t.getSchemaDescriptor();
            }
          else if (p instanceof ViewDescriptor)
          {
            ViewDescriptor v = (ViewDescriptor)p; 
            s = dd.getSchemaDescriptor(v.getCompSchemaId(), tc);
          }
            else if (p instanceof AliasDescriptor)
            {
              AliasDescriptor a = (AliasDescriptor)p;
            s = dd.getSchemaDescriptor( a.getSchemaUUID(), tc);
View Full Code Here

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

    /* Resolve the view, if this is a view */
    if (tableDescriptor.getTableType() == TableDescriptor.VIEW_TYPE)
    {
      FromSubquery                fsq;
      ResultSetNode        rsn;
      ViewDescriptor        vd;
      CreateViewNode        cvn;
      SchemaDescriptor      compSchema;

      /* Get the associated ViewDescriptor so that we can get
       * the view definition text.
       */
      vd = dataDictionary.getViewDescriptor(tableDescriptor);

      /*
      ** Set the default compilation schema to be whatever
      ** this schema this view was originally compiled against.
      ** That way we pick up the same tables no matter what
      ** schema we are running against.
      */
      compSchema = dataDictionary.getSchemaDescriptor(vd.getCompSchemaId(), null);

      compilerContext.pushCompilationSchema(compSchema);
 
      try
      {
   
        /* This represents a view - query is dependent on the ViewDescriptor */
        compilerContext.createDependency(vd);
 
        if (SanityManager.DEBUG)
        {
          SanityManager.ASSERT(vd != null,
            "vd not expected to be null for " + tableName);
        }
 
        cvn = (CreateViewNode)
                  parseStatement(vd.getViewText(), false);

        rsn = cvn.getParsedQueryExpression();
 
        /* If the view contains a '*' then we mark the views derived column list
         * so that the view will still work, and return the expected results,
View Full Code Here

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

   * @exception StandardException    Thrown on error
   */
  private ViewDescriptor getViewDescriptorScan(TableDescriptor tdi)
    throws StandardException
  {
    ViewDescriptor      vd;
    DataValueDescriptor    viewIdOrderable;
    TabInfoImpl          ti = getNonCoreTI(SYSVIEWS_CATALOG_NUM);
    UUID          viewID = tdi.getUUID();

    /* Use viewIdOrderable in both start
     * and stop position for scan.
     */
    viewIdOrderable = getIDValueAsCHAR(viewID);

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

        vd = getDescriptorViaIndex(
            SYSVIEWSRowFactory.SYSVIEWS_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
            (TupleDescriptor) null,
            (List<TupleDescriptor>) null,
                        ViewDescriptor.class,
            false);

    if (vd != null)
    {
      vd.setViewName(tdi.getName());
    }
    return vd;
  }
View Full Code Here

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

  private void bindPrivilegesForView ( TableDescriptor td)
    throws StandardException
  {
    LanguageConnectionContext lcc = getLanguageConnectionContext();
    DataDictionary dd = lcc.getDataDictionary();
    ViewDescriptor vd = dd.getViewDescriptor(td);
    DependencyManager dm = dd.getDependencyManager();
    ProviderInfo[] pis = dm.getPersistentProviderInfos(vd);
    this.descriptorList = new ArrayList<Provider>();
         
    int siz = pis.length;
View Full Code Here

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

    int               checkIType;

    if (td != null)
    {
      UUID  tableUUID;
      ViewDescriptor vd = (ViewDescriptor)td;

      /*
      ** We only allocate a new UUID if the descriptor doesn't already have one.
      ** For descriptors replicated from a Source system, we already have an UUID.
      */
      tableUUID = vd.getUUID();
      if ( tableUUID == null )
        {
        tableUUID = getUUIDFactory().createUUID();
        vd.setUUID(tableUUID);
      }
      tableID = tableUUID.toString();
      viewText = vd.getViewText();

      /* RESOLVE - check constraints not supported yet */
      checkIType = vd.getCheckOptionType();

      if (SanityManager.DEBUG)
      {
        if (checkIType != ViewDescriptor.NO_CHECK_OPTION)
        {
          SanityManager.THROWASSERT("checkIType expected to be " +
            ViewDescriptor.NO_CHECK_OPTION +
            ", not " + checkIType);
        }
      }
      checkSType = "N";

      UUID tmpId = vd.getCompSchemaId();
      compSchemaId = (tmpId == null) ? null : tmpId.toString();
    }

    /* Insert info into sysviews */

 
View Full Code Here

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

    ExecRow          row,
    TupleDescriptor      parentTupleDescriptor,
    DataDictionary       dd )
          throws StandardException
  {
    ViewDescriptor vd = null;

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(
        row.nColumns() == SYSVIEWS_COLUMN_COUNT,
View Full Code Here

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

   */
  public void  executeConstantAction( Activation activation )
            throws StandardException
  {
    TableDescriptor td;
    ViewDescriptor vd;

    LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
    DataDictionary dd = lcc.getDataDictionary();

    /*
    ** Inform the data dictionary that we are about to write to it.
    ** There are several calls to data dictionary "get" methods here
    ** that might be done in "read" mode in the data dictionary, but
    ** it seemed safer to do this whole operation in "write" mode.
    **
    ** We tell the data dictionary we're done writing at the end of
    ** the transaction.
    */
    dd.startWriting(lcc);

    /* Get the table descriptor.  We're responsible for raising
     * the error if it isn't found
     */
    td = dd.getTableDescriptor(tableName, sd,
                lcc.getTransactionExecute());

    if (td == null)
    {
      throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION, fullTableName);
    }

    /* Verify that TableDescriptor represents a view */
    if (td.getTableType() != TableDescriptor.VIEW_TYPE)
    {
      throw StandardException.newException(SQLState.LANG_DROP_VIEW_ON_NON_VIEW, fullTableName);
    }

    vd = dd.getViewDescriptor(td);

    vd.drop(lcc, sd, td);
  }
View Full Code Here

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

            TableDescriptor t = (TableDescriptor)p;
            s = t.getSchemaDescriptor();
            }
          else if (p instanceof ViewDescriptor)
          {
            ViewDescriptor v = (ViewDescriptor)p; 
            s = dd.getSchemaDescriptor(v.getCompSchemaId(), tc);
          }
            else if (p instanceof AliasDescriptor)
            {
              AliasDescriptor a = (AliasDescriptor)p;
            s = dd.getSchemaDescriptor( a.getSchemaUUID(), tc);
View Full Code Here

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

            throws StandardException
  {
    TableDescriptor       td;
    UUID             toid;
    ColumnDescriptor      columnDescriptor;
    ViewDescriptor        vd;

    LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
    DataDictionary dd = lcc.getDataDictionary();
    DependencyManager dm = dd.getDependencyManager();
    TransactionController tc = lcc.getTransactionExecute();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.