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

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


    SystemColumn[]    columns = rowFactory.buildColumnList();
    ExecRow        templateRow = rowFactory.makeEmptyRow();
    int          columnCount = newColumnIDs.length;
    SchemaDescriptor  sd = getSystemSchemaDescriptor();
    TableDescriptor    td;
    long        conglomID;

    // Special case when adding a column to systables or syscolumns,
    // since we can't go to systables/syscolumns to get the
    // table/column descriptor until after we add and populate the new column.
    if (rowFactory instanceof SYSTABLESRowFactory)
    {
      td = dataDescriptorGenerator.newTableDescriptor(
            "SYSTABLES",
            sd,
            TableDescriptor.BASE_TABLE_TYPE,
            TableDescriptor.ROW_LOCK_GRANULARITY);
      td.setUUID(getUUIDForCoreTable("SYSTABLES", sd.getUUID().toString(), tc));
      conglomID = coreInfo[SYSTABLES_CORE_NUM].getHeapConglomerate();
    }
    else if (rowFactory instanceof SYSCOLUMNSRowFactory)
    {
      td = dataDescriptorGenerator.newTableDescriptor(
            "SYSCOLUMNS",
            sd,
            TableDescriptor.BASE_TABLE_TYPE,
            TableDescriptor.ROW_LOCK_GRANULARITY);
      td.setUUID(getUUIDForCoreTable("SYSCOLUMNS", sd.getUUID().toString(), tc));
      conglomID = coreInfo[SYSCOLUMNS_CORE_NUM].getHeapConglomerate();
    }
    else
    {
      td = getTableDescriptor( rowFactory.getCatalogName(), sd );
      conglomID = td.getHeapConglomerateId();
    }

    widenConglomerate( templateRow, newColumnIDs, conglomID, tc );

View Full Code Here


    String        name = ti.getTableName();
    long        conglomId = ti.getHeapConglomerate();
    SystemColumn[]    columnList = crf.buildColumnList();
    UUID        heapUUID = crf.getCanonicalHeapUUID();
    String        heapName = crf.getCanonicalHeapName();
    TableDescriptor    td;
    UUID        toid;
    ColumnDescriptor  cd;
    int          columnCount;
    SystemColumn    column;

    // add table to the data dictionary

    columnCount = columnList.length;
    td = ddg.newTableDescriptor(name, sd, TableDescriptor.SYSTEM_TABLE_TYPE,
                    TableDescriptor.ROW_LOCK_GRANULARITY);
    td.setUUID(crf.getCanonicalTableUUID());
    addDescriptor(td, sd, SYSTABLES_CATALOG_NUM,
            false, tc);
    toid = td.getUUID();
 
    /* Add the conglomerate for the heap */
    ConglomerateDescriptor cgd = ddg.newConglomerateDescriptor(conglomId,
                                  heapName,
                                  false,
                                  null,
                                  false,
                                  heapUUID,
                                    toid,
                                  sd.getUUID());

    addDescriptor(cgd, sd, SYSCONGLOMERATES_CATALOG_NUM, false, tc);

    /* Create the columns */
    ColumnDescriptor[] cdlArray = new ColumnDescriptor[columnCount];

    for (int columnNumber = 0; columnNumber < columnCount; columnNumber++)
    {
      column = columnList[columnNumber];

      if (SanityManager.DEBUG)
      {
        if (column == null)
        {
          SanityManager.THROWASSERT("column "+columnNumber+" for table "+ti.getTableName()+" is null");
        }
      }
      cdlArray[columnNumber] = makeColumnDescriptor( column,
                    columnNumber + 1, td );
    }
    addDescriptorArray(cdlArray, td, SYSCOLUMNS_CATALOG_NUM, false, tc);
   
    // now add the columns to the cdl of the table.
    ColumnDescriptorList cdl = td.getColumnDescriptorList();
    for (int i = 0; i < columnCount; i++)
      cdl.add(cdlArray[i]);
  }
View Full Code Here

      if (ti.isComplete())
      {
        return;
      }

      TableDescriptor td = getTableDescriptor(ti.getTableName(),
                          getSystemSchemaDescriptor());

      // It's possible that the system table is not there right
      // now. This can happen, for example, if we're in the
      // process of upgrading a source or target to Xena, in
      // which case SYSSYNCINSTANTS is dropped and re-created.
      // Just return in this case, so we don't get a null pointer
      // exception.
      if (td == null)
      {
        return;
      }

      ConglomerateDescriptor cd = null;
      ConglomerateDescriptor[] cds = td.getConglomerateDescriptors();

      /* Init the heap conglomerate here */
      for (int index = 0; index < cds.length; index++)
      {
        cd = cds[index];
View Full Code Here

     * the compiler context.
     */
    UUID triggerTableId;
    if ((triggerTableId = getSpecialTriggerVTITableName(lcc, newInvocation.getJavaClassName())) != null
    {
      TableDescriptor td = getDataDictionary().getTableDescriptor(triggerTableId);
      resultColumns = genResultColList(td);

      // costing info
      vtiCosted = true;
      estimatedCost = 50d;
View Full Code Here

  public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList,
      Vector  aggregateVector)
    throws StandardException
  {
    ColumnDescriptor  cd;
    TableDescriptor    td;

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(fromList.size() != 0,
        "fromList expected to be non-empty");
      if (! (fromList.elementAt(0) instanceof FromBaseTable))
      {
        SanityManager.THROWASSERT(
          "fromList.elementAt(0) expected to be instanceof FromBaseTable, not " +
          fromList.elementAt(0).getClass().getName());
      }

    }
    // Get the TableDescriptor for the target table
    td = ((FromBaseTable) fromList.elementAt(0)).getTableDescriptor();

    // Get the ColumnDescriptor for the column
    cd = td.getColumnDescriptor(columnName);
    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(cd != null,
        "cd expected to be non-null");
    }
View Full Code Here

            TableName tableName = (TableName) objectOfPrivilege;
            sd = getSchemaDescriptor( tableName.getSchemaName(), true);
            if (sd.isSystemSchema())
                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, tableName.getFullTableName());
       
            TableDescriptor td = getTableDescriptor( tableName.getTableName(), sd);
            if( td == null)
                throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, tableName);

            // Don't allow authorization on SESSION schema tables. Causes confusion if
            // a temporary table is created later with same name.
            if (isSessionSchema(sd.getSchemaName()))
                throw StandardException.newException(SQLState.LANG_OPERATION_NOT_ALLOWED_ON_SESSION_SCHEMA_TABLES);

            if (td.getTableType() != TableDescriptor.BASE_TABLE_TYPE &&
                td.getTableType() != TableDescriptor.VIEW_TYPE)
                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, tableName.getFullTableName());

      // Can not grant/revoke permissions from self
      if (grantees.contains(sd.getAuthorizationId()))
        throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
             td.getQualifiedName());

            specificPrivileges.bind( td, isGrant);
            dependencyProvider = td;
            break;
View Full Code Here

      if (ti.isComplete())
      {
        return;
      }

      TableDescriptor td = getTableDescriptor(ti.getTableName(),
                          getSystemSchemaDescriptor());

      // It's possible that the system table is not there right
      // now. This can happen, for example, if we're in the
      // process of upgrading a source or target to Xena, in
      // which case SYSSYNCINSTANTS is dropped and re-created.
      // Just return in this case, so we don't get a null pointer
      // exception.
      if (td == null)
      {
        return;
      }

      ConglomerateDescriptor cd = null;
      ConglomerateDescriptor[] cds = td.getConglomerateDescriptors();

      /* Init the heap conglomerate here */
      for (int index = 0; index < cds.length; index++)
      {
        cd = cds[index];
View Full Code Here

   */
  public TableDescriptor    getTableDescriptor(String tableName,
          SchemaDescriptor schema)
      throws StandardException
  {
    TableDescriptor    retval = null;

    /*
    ** If we didn't get a schema descriptor, we had better
    ** have a system table.
    */
    if (SanityManager.DEBUG)
    {
      if ((schema == null) && !tableName.startsWith("SYS"))
      {
        SanityManager.THROWASSERT("null schema for non system table "+tableName);
      }
    }

    SchemaDescriptor sd = (schema == null) ?
        getSystemSchemaDescriptor()
        : schema;

    UUID schemaUUID = sd.getUUID();
   
    if (SchemaDescriptor.STD_SYSTEM_DIAG_SCHEMA_NAME.equals(
        sd.getSchemaName()))
    {
      TableDescriptor td =
        new TableDescriptor(this, tableName, sd,
            TableDescriptor.VTI_TYPE,
            TableDescriptor.DEFAULT_LOCK_GRANULARITY);
     
      // ensure a vti class exists
      if (getVTIClass(td, false) != null)
View Full Code Here

                    String schemaUUID)
        throws StandardException
  {
    DataValueDescriptor      schemaIDOrderable;
    DataValueDescriptor      tableNameOrderable;
    TableDescriptor        td;
    TabInfoImpl            ti = coreInfo[SYSTABLES_CORE_NUM];

    /* Use tableNameOrderable and schemaIdOrderable in both start
     * and stop position for scan.
     */
 
View Full Code Here

   */
  public TableDescriptor    getTableDescriptor(UUID tableID)
      throws StandardException
  {
    OIDTDCacheable    cacheEntry;
    TableDescriptor  retval = null;

    /* Only use the cache if we're in compile-only mode */
    if (getCacheMode() == DataDictionary.COMPILE_ONLY_MODE)
    {
      cacheEntry = (OIDTDCacheable) OIDTdCache.find(tableID);
      if (cacheEntry != null)
      {
        retval = cacheEntry.getTableDescriptor();
        // bind in previous command might have set refernced cols
        retval.setReferencedColumnMap(null);
        OIDTdCache.release(cacheEntry);
      }

      return retval;

View Full Code Here

TOP

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

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.