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

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


   */
  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) != 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

  private TableDescriptor getTableDescriptorIndex2Scan(
                    String tableUUID)
        throws StandardException
  {
    DataValueDescriptor      tableIDOrderable;
    TableDescriptor        td;
    TabInfoImpl            ti = coreInfo[SYSTABLES_CORE_NUM];

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

   * @exception StandardException    Thrown on error
   */
  public ViewDescriptor  getViewDescriptor(TableDescriptor td)
    throws StandardException
  {
    TableDescriptor  tdi = (TableDescriptor) td;

    /* See if the view info is cached */
    if (tdi.getViewDescriptor() != null)
    {
      return tdi.getViewDescriptor();
    }

    synchronized(tdi)
    {
      /* See if we were waiting on someone who just filled it in */
      if (tdi.getViewDescriptor() != null)
      {
        return tdi.getViewDescriptor();
      }

      tdi.setViewDescriptor((ViewDescriptor) getViewDescriptorScan(tdi));
    }
    return tdi.getViewDescriptor();
  }
View Full Code Here

            (TupleDescriptor) null,
            fkList,
            false);

    SubKeyConstraintDescriptor cd;
    TableDescriptor td;
    ConstraintDescriptorList cdl = new ConstraintDescriptorList();
    ConstraintDescriptorList tmpCdl;

    for (Iterator iterator = fkList.iterator(); iterator.hasNext(); )
    {
View Full Code Here

    ConglomerateController  heapCC = null;
    ScanController      scanController = null;
    TransactionController  tc;
    TabInfoImpl         ti = getNonCoreTI(SYSCONSTRAINTS_CATALOG_NUM);
    SYSCONSTRAINTSRowFactory rf = (SYSCONSTRAINTSRowFactory) ti.getCatalogRowFactory();
    TableDescriptor      td = null;
    List          slist = newSList();

    if (SanityManager.DEBUG)
    {
      SanityManager.ASSERT(indexId == SYSCONSTRAINTSRowFactory.SYSCONSTRAINTS_INDEX1_ID ||
View Full Code Here

        // than fetch, so that the fetch happens while latch is held, otherwise
        // the next() might position the scan on a row, but the subsequent
        // fetch() may find the row deleted or purged from the table.
    while(scanController.fetchNext(outRow.getRowArray()))
    {
      TableDescriptor td = (TableDescriptor)
        rf.buildDescriptor(outRow, (TupleDescriptor)null,
                   this);
      ht.put(td.getUUID(), td);
    }
    scanController.close();
    return ht;
  }
View Full Code Here

   */
  public void  executeConstantAction( Activation activation )
            throws StandardException
  {
    ConstraintDescriptor    conDesc = null;
    TableDescriptor        td;
    UUID              indexId = null;
    String            indexUUIDString;

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


    /*
    ** 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);

    td = dd.getTableDescriptor(tableId);

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

    /* Table gets locked in AlterTableConstantAction */

    /*
    ** If the schema descriptor is null, then
    ** we must have just read ourselves in. 
    ** So we will get the corresponding schema
    ** descriptor from the data dictionary.
    */

    SchemaDescriptor tdSd = td.getSchemaDescriptor();
    SchemaDescriptor constraintSd =
      constraintSchemaName == null ? tdSd : dd.getSchemaDescriptor(constraintSchemaName, tc, true);


    /* Get the constraint descriptor for the index, along
     * with an exclusive row lock on the row in sys.sysconstraints
     * in order to ensure that no one else compiles against the
     * index.
     */
    if (constraintName == null// this means "alter table drop primary key"
      conDesc = dd.getConstraintDescriptors(td).getPrimaryKey();
    else
      conDesc = dd.getConstraintDescriptorByName(td, constraintSd, constraintName, true);

    // Error if constraint doesn't exist
    if (conDesc == null)
    {
      String errorName = constraintName == null ? "PRIMARY KEY" :
                (constraintSd.getSchemaName() + "."+ constraintName);

      throw StandardException.newException(SQLState.LANG_DROP_NON_EXISTENT_CONSTRAINT,
            errorName,
            td.getQualifiedName());
    }
        switch( verifyType)
        {
        case DataDictionary.UNIQUE_CONSTRAINT:
            if( conDesc.getConstraintType() != verifyType)
View Full Code Here

    SystemColumn    theColumn;
    SystemColumn[]    columns = rowFactory.buildColumnList();
    SchemaDescriptor  sd = getSystemSchemaDescriptor();
    String columnName;

    TableDescriptor td = getTableDescriptor(rowFactory.getCatalogName(), sd);

    theColumn = columns[columnNumber - 1]// from 1 to 0 based
    ColumnDescriptor cd = makeColumnDescriptor(theColumn, columnNumber, td );
    columnName = cd.getColumnName();
    cd.getType().setNullability(nullability);
    int[] columnNameColArray = new int[1];
    columnNameColArray[0] = SYSCOLUMNSRowFactory.SYSCOLUMNS_COLUMNDATATYPE ;
    updateColumnDescriptor(cd,
                td.getUUID(),
                columnName,
                columnNameColArray,
                tc,
                true);
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.