Package org.apache.derby.catalog

Examples of org.apache.derby.catalog.UUID


     **/
    private void create_10_3_system_procedures_SYSIBM(
        TransactionController   tc)
        throws StandardException {
        //create 10.3 functions used by LOB methods.
        UUID schema_uuid = getSysIBMSchemaDescriptor().getUUID();
        {
            UUID routine_uuid = null;
            String[] arg_names = null;

            TypeDescriptor[] arg_types = null;

            routine_uuid = createSystemProcedureOrFunction(
                "CLOBCREATELOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER, Integer.MAX_VALUE),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR"};

            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)};

            routine_uuid = createSystemProcedureOrFunction(
                "CLOBRELEASELOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                null,
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","SEARCHSTR","POS"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARCHAR),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBGETPOSITIONFROMSTRING",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","SEARCHLOCATOR","POS"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBGETPOSITIONFROMLOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBGETLENGTH",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","POS","LEN"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBGETSUBSTRING",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARCHAR, Limits.DB2_VARCHAR_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","POS","LEN","REPLACESTR"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARCHAR)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBSETSTRING",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                null,
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","LEN"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "CLOBTRUNCATE",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                null,
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }

        //Now create the Stored procedures required for BLOB
        {
            UUID routine_uuid = null;
            String[] arg_names = null;

            TypeDescriptor[] arg_types = null;

            routine_uuid = createSystemProcedureOrFunction(
                "BLOBCREATELOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER, Integer.MAX_VALUE),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR"};

            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)};

            routine_uuid = createSystemProcedureOrFunction(
                "BLOBRELEASELOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                null,
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","SEARCHBYTES","POS"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARBINARY),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "BLOBGETPOSITIONFROMBYTES",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","SEARCHLOCATOR","POS"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "BLOBGETPOSITIONFROMLOCATOR",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "BLOBGETLENGTH",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT, Limits.DB2_LOB_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","POS","LEN"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "BLOBGETBYTES",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARBINARY, Limits.DB2_VARCHAR_MAXWIDTH),
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","POS","LEN","REPLACEBYTES"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.BIGINT),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.INTEGER),
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARBINARY)
            };
            routine_uuid = createSystemProcedureOrFunction(
                "BLOBSETBYTES",
                schema_uuid,
                arg_names,
                arg_types,
                0,
                0,
                RoutineAliasInfo.CONTAINS_SQL,
                null,
                tc,
                "org.apache.derby.impl.jdbc.LOBStoredProcedure");
        }
        {
            UUID routine_uuid = null;
            String[] arg_names = {"LOCATOR","LEN"};

            // procedure argument types
            TypeDescriptor[] arg_types = {
                DataTypeDescriptor.getBuiltInDataTypeDescriptor(
View Full Code Here


        // not modified during the creation of the routine
        TypeDescriptor varchar128 =
            DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARCHAR, 128);

        UUID  sysUtilUUID = getSystemUtilSchemaDescriptor().getUUID();
        /* SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(IN SCHEMANAME  VARCHAR(128),
         * IN TABLENAME    VARCHAR(128), IN FILENAME VARCHAR(32672) ,
         * IN COLUMNDELIMITER CHAR(1),  IN CHARACTERDELIMITER CHAR(1) , 
         * IN CODESET VARCHAR(128), IN LOBSFILENAME VARCHAR(32672) )
         */
 
View Full Code Here

   */
  public void  executeConstantAction( Activation activation )
            throws StandardException
  {
    TableDescriptor td;
    UUID tableID;
    ConglomerateDescriptor[] cds;

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

  {
    DataTypeDescriptor    dtd;
    ExecRow            row;
    DataValueDescriptor    col;
    String          name = null;
    UUID          uuid = null
    UUID          suuid = null;      // schema 
    UUID          tuuid = null;      // referenced table 
    UUID          actionSPSID = null;    // action sps uuid string
    UUID          whenSPSID = null;    // when clause sps uuid string
    Timestamp        createTime = null;
    String          event = null;
    String          time = null;
    String          type = null;
    String          enabled = null;
    String          triggerDefinition = null;
    String          oldReferencingName = null;
    String          newReferencingName = null;
    ReferencedColumns rcd = null;
    boolean          referencingOld = false;
    boolean          referencingNew = false;

    if (td != null)
    {
      TriggerDescriptor triggerDescriptor = (TriggerDescriptor)td;
      name = triggerDescriptor.getName();
      uuid = triggerDescriptor.getUUID();
      suuid = triggerDescriptor.getSchemaDescriptor().getUUID();
      createTime = triggerDescriptor.getCreationTimestamp();
      // for now we are assuming that a trigger can only listen to a single event
      event = triggerDescriptor.listensForEvent(TriggerDescriptor.TRIGGER_EVENT_UPDATE) ? "U" :
          triggerDescriptor.listensForEvent(TriggerDescriptor.TRIGGER_EVENT_DELETE) ? "D" : "I";
      time = triggerDescriptor.isBeforeTrigger() ? "B" : "A";
      type = triggerDescriptor.isRowTrigger() ? "R" : "S";
      enabled = triggerDescriptor.isEnabled() ? "E" : "D";
      tuuid = triggerDescriptor.getTableDescriptor().getUUID();
      int[] refCols = triggerDescriptor.getReferencedCols();
      rcd = (refCols != null) ? new
        ReferencedColumnsDescriptorImpl(refCols) : null;

      actionSPSID =  triggerDescriptor.getActionId();
      whenSPSID =  triggerDescriptor.getWhenClauseId();
      triggerDefinition = triggerDescriptor.getTriggerDefinition();
      referencingOld = triggerDescriptor.getReferencingOld();
      referencingNew = triggerDescriptor.getReferencingNew();
      oldReferencingName = triggerDescriptor.getOldReferencingName();
      newReferencingName = triggerDescriptor.getNewReferencingName();
    }

    /* Build the row to insert */
    row = getExecutionFactory().getValueRow(SYSTRIGGERS_COLUMN_COUNT);

    /* 1st column is TRIGGERID */
    row.setColumn(1, new SQLChar((uuid == null) ? null : uuid.toString()));

    /* 2nd column is TRIGGERNAME */
    row.setColumn(2, new SQLVarchar(name));

    /* 3rd column is SCHEMAID */
    row.setColumn(3, new SQLChar((suuid == null) ? null : suuid.toString()));

    /* 4th column is CREATIONTIMESTAMP */
    row.setColumn(4, dvf.getDataValue(createTime));

    /* 5th column is EVENT */
    row.setColumn(5, new SQLChar(event));

    /* 6th column is FIRINGTIME */
    row.setColumn(6, new SQLChar(time));

    /* 7th column is TYPE */
    row.setColumn(7, new SQLChar(type));

    /* 8th column is STATE */
    row.setColumn(8, new SQLChar(enabled));

    /* 9th column is TABLEID */
    row.setColumn(9, new SQLChar((tuuid == null) ? null : tuuid.toString()));

    /* 10th column is WHENSTMTID */
    row.setColumn(10, new SQLChar((whenSPSID == null) ? null : whenSPSID.toString()));

    /* 11th column is ACTIONSTMTID */
    row.setColumn(11, new SQLChar((actionSPSID == null) ? null : actionSPSID.toString()));

    /* 12th column is REFERENCEDCOLUMNS
View Full Code Here

    char          theChar;
    String          uuidStr;
    String          triggerDefinition;
    String          oldReferencingName;
    String          newReferencingName;
    UUID          uuid; 
    UUID          suuid;          // schema 
    UUID          tuuid;          // referenced table 
    UUID          actionSPSID = null;    // action sps uuid string
    UUID          whenSPSID = null;    // when clause sps uuid string
    Timestamp        createTime;
    int            eventMask = 0;
    boolean          isBefore;
    boolean          isRow;
    boolean          isEnabled;
View Full Code Here

    }

    DataValueDescriptor col;
    String scratch;
    UUIDFactory uuidFactory = getUUIDFactory();
    UUID statUUID, statReferenceUUID, statTableUUID;
    String statName;
   
    /* 1st column is UUID */
    col = row.getColumn(SYSSTATISTICS_ID);
    scratch = col.getString();
View Full Code Here

    boolean            forCreateTable;
    ConglomerateDescriptor    conglomDesc = null;
    ConglomerateDescriptor[]  conglomDescs = null;
    ConstraintDescriptor    conDesc = null;
    TableDescriptor        td = null;
    UUID            indexId = null;
    String            uniqueName;
    String            backingIndexName;

    /* RESOLVE - blow off not null constraints for now (and probably for ever) */
    if (constraintType == DataDictionary.NOTNULL_CONSTRAINT)
    {
      return;
    }

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

    cf = lcc.getLanguageConnectionFactory().getClassFactory();

    /* Remember whether or not we are doing a create table */
    forCreateTable = activation.getForCreateTable();

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

    /* 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 sd = dd.getSchemaDescriptor(schemaName, tc, true);
   
    /* Try to get the TableDescriptor from
     * the Activation. We will go to the
     * DD if not there. (It should always be
     * there except when in a target.)
     */
    td = activation.getDDLTableDescriptor();

    if (td == null)
    {
      /* tableId will be non-null if adding a
       * constraint to an existing table.
       */
      if (tableId != null)
      {
        td = dd.getTableDescriptor(tableId);
      }
      else
      {
        td = dd.getTableDescriptor(tableName, sd);
      }

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

    /* Generate the UUID for the backing index.  This will become the
     * constraint's name, if no name was specified.
     */
    UUIDFactory uuidFactory = dd.getUUIDFactory();
       
    /* Create the index, if there's one for this constraint */
    if (indexAction != null)
    {
      if ( indexAction.getIndexName() == null )
      {
        /* Set the index name */
        backingIndexName =  uuidFactory.createUUID().toString();
        indexAction.setIndexName(backingIndexName);
      }
      else { backingIndexName = indexAction.getIndexName(); }


      /* Create the index */
      indexAction.executeConstantAction(activation);

      /* Get the conglomerate descriptor for the backing index */
      conglomDescs = td.getConglomerateDescriptors();

      for (int index = 0; index < conglomDescs.length; index++)
      {
        conglomDesc = conglomDescs[index];

        /* Check for conglomerate being an index first, since
         * name is null for heap.
         */
        if (conglomDesc.isIndex() &&
          backingIndexName.equals(conglomDesc.getConglomerateName()))
        {
          break;
        }
      }

      if (SanityManager.DEBUG)
      {
        SanityManager.ASSERT(conglomDesc != null,
          "conglomDesc is expected to be non-null after search for backing index");
        SanityManager.ASSERT(conglomDesc.isIndex(),
          "conglomDesc is expected to be indexable after search for backing index");
        SanityManager.ASSERT(conglomDesc.getConglomerateName().equals(backingIndexName),
         "conglomDesc name expected to be the same as backing index name after search for backing index");
      }

      indexId = conglomDesc.getUUID();
    }

    UUID constraintId = uuidFactory.createUUID();

    /* Now, lets create the constraint descriptor */
    DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
    switch (constraintType)
    {
View Full Code Here

  (
           Activation activation)
    throws StandardException
  {
    TableDescriptor td;
    UUID tableID;

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

   */
  public void  executeConstantAction( Activation activation )
    throws StandardException
  {
    TableDescriptor       td;
    UUID             toid;
    SchemaDescriptor      schemaDescriptor;
    ColumnDescriptor      columnDescriptor;
    ExecRow            template;

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

    /* Mark the activation as being for create table */
    activation.setForCreateTable();

        // setup for create conglomerate call:
        //   o create row template to tell the store what type of rows this
        //     table holds.
        //   o create array of collation id's to tell collation id of each
        //     column in table.
    template            = RowUtil.getEmptyValueRow(columnInfo.length, lcc);
        int[] collation_ids = new int[columnInfo.length];

    for (int ix = 0; ix < columnInfo.length; ix++)
    {
            ColumnInfo  col_info = columnInfo[ix];

            // Get a template value for each column

      if (col_info.defaultValue != null)
            {
                /* If there is a default value, use it, otherwise use null */
        template.setColumn(ix + 1, col_info.defaultValue);
            }
      else
            {
        template.setColumn(ix + 1, col_info.dataType.getNull());
            }

            // get collation info for each column.

            collation_ids[ix] = col_info.dataType.getCollationType();
    }


    /* create the conglomerate to hold the table's rows
     * RESOLVE - If we ever have a conglomerate creator
     * that lets us specify the conglomerate number then
     * we will need to handle it here.
     */
    long conglomId = tc.createConglomerate(
        "heap", // we're requesting a heap conglomerate
        template.getRowArray(), // row template
        null, //column sort order - not required for heap
                collation_ids,
        properties, // properties
        tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE ?
                    (TransactionController.IS_TEMPORARY |
                     TransactionController.IS_KEPT) :
                        TransactionController.IS_DEFAULT);

    /*
    ** 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.
    */
    if ( tableType != TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE )
      dd.startWriting(lcc);

    SchemaDescriptor sd;
    if (tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE)
      sd = dd.getSchemaDescriptor(schemaName, tc, true);
    else
      sd = DDLConstantAction.getSchemaDescriptorForCreate(dd, activation, schemaName);

    //
    // Create a new table descriptor.
    //
    DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();

    if ( tableType != TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE )
    {
      td = ddg.newTableDescriptor(tableName, sd, tableType, lockGranularity);
      dd.addDescriptor(td, sd, DataDictionary.SYSTABLES_CATALOG_NUM, false, tc);
    } else
    {
      td = ddg.newTableDescriptor(tableName, sd, tableType, onCommitDeleteRows, onRollbackDeleteRows);
      td.setUUID(dd.getUUIDFactory().createUUID());
    }
    toid = td.getUUID();

    // Save the TableDescriptor off in the Activation
    activation.setDDLTableDescriptor(td);

    /* NOTE: We must write the columns out to the system
     * tables before any of the conglomerates, including
     * the heap, since we read the columns before the
     * conglomerates when building a TableDescriptor.
     * This will hopefully reduce the probability of
     * a deadlock involving those system tables.
     */
   
    // for each column, stuff system.column
    int index = 1;

    ColumnDescriptor[] cdlArray = new ColumnDescriptor[columnInfo.length];
    for (int ix = 0; ix < columnInfo.length; ix++)
    {
      UUID defaultUUID = columnInfo[ix].newDefaultUUID;

      /* Generate a UUID for the default, if one exists
       * and there is no default id yet.
       */
      if (columnInfo[ix].defaultInfo != null &&
View Full Code Here

                                   long numRows, long[] cardinality,
                                   boolean asBackgroundTask)
            throws StandardException {
        TransactionController tc = lcc.getTransactionExecute();
        trace(1, "writing new stats (xid=" + tc.getTransactionIdString() + ")");
        UUID table = td.getUUID();
        DataDictionary dd = lcc.getDataDictionary();
        UUIDFactory uf = dd.getUUIDFactory();

        // Update the heap row count estimate.
        setHeapRowEstimate(tc, td.getHeapConglomerateId(), numRows);
View Full Code Here

TOP

Related Classes of org.apache.derby.catalog.UUID

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.