Package org.apache.derby.iapi.services.context

Examples of org.apache.derby.iapi.services.context.ContextManager


      expr = orExpression(expr, false);
    }
    jj_consume_token(THEN);
    thenExpr = thenElseExpression();
    elseExpr = caseExpression();
                ContextManager cm = getContextManager();
                ValueNodeList thenElseList = (ValueNodeList) nodeFactory.getNode(C_NodeTypes.VALUE_NODE_LIST, cm);
                thenElseList.addElement(thenExpr); // then
                thenElseList.addElement(elseExpr); // else

                {if (true) return((ValueNode) nodeFactory.getNode(C_NodeTypes.CONDITIONAL_NODE,
View Full Code Here


                    C_NodeTypes.TABLE_NAME,
                    null,
                    null,
                    getContextManager());

    ContextManager cm = getContextManager();

    int size = visibleSize();
    for (int index = 0; index < size; index++)
    {
      boolean     nullableResult;
View Full Code Here

    TableName  tableName,
    String    columnName
  )
    throws StandardException
  {
    ContextManager  cm = getContextManager();
    NodeFactory    nodeFactory = getNodeFactory();

    ResultColumn  rc = (ResultColumn) nodeFactory.getNode
      (
        C_NodeTypes.RESULT_COLUMN,
View Full Code Here

   *
   * @exception StandardException    Thrown on error
   */
        ValueNode getNumericNode(String num) throws StandardException
        {
                ContextManager cm = getContextManager();

                // first, see if it might be an integer
                try
                {
                        return (ValueNode) nodeFactory.getNode(
View Full Code Here

        case LENGTH:
          jj_consume_token(LENGTH);
          jj_consume_token(LEFT_PAREN);
          value = additiveExpression(null,0, false);
          jj_consume_token(RIGHT_PAREN);
                ContextManager  localCM = getContextManager();
                if( isJDBCEscape)
                        {if (true) return (ValueNode) nodeFactory.getNode(
                                                                C_NodeTypes.CHAR_LENGTH_OPERATOR_NODE,
                                                                (ValueNode) nodeFactory.getNode(
                                                                        C_NodeTypes.TRIM_OPERATOR_NODE,
View Full Code Here

      jj_consume_token(COMMA);
      rightExpression = additiveExpression(null, 0, false);
      jj_consume_token(RIGHT_PAREN);
                // "NULLIF(L, R)" is the same as "L=R ? untyped NULL : L"
                // An impl assumption here is that Cloudscape can promote CHAR to any comparable datatypes such as numeric
                ContextManager cm = getContextManager();
                ValueNodeList thenElseList = (ValueNodeList) nodeFactory.getNode(C_NodeTypes.VALUE_NODE_LIST, cm);

                //Use untyped null for then clause at this point. At the bind time, we will cast it to the datatype of L
                thenElseList.addElement((ValueNode) nodeFactory.getNode(
                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
View Full Code Here

      expr = orExpression(expr, false);
    }
    jj_consume_token(THEN);
    thenExpr = thenElseExpression();
    elseExpr = caseExpression();
                ContextManager cm = getContextManager();
                ValueNodeList thenElseList = (ValueNodeList) nodeFactory.getNode(C_NodeTypes.VALUE_NODE_LIST, cm);
                thenElseList.addElement(thenExpr); // then
                thenElseList.addElement(elseExpr); // else

                {if (true) return((ValueNode) nodeFactory.getNode(C_NodeTypes.CONDITIONAL_NODE,
View Full Code Here

    } // end of preprocess

    private void pushOrderingDown( ResultSetNode rsn)
        throws StandardException
    {
        ContextManager cm = getContextManager();
        NodeFactory nf = getNodeFactory();
        OrderByList orderByList = (OrderByList) nf.getNode( C_NodeTypes.ORDER_BY_LIST, cm);
        for( int i = 0; i < intermediateOrderByColumns.length; i++)
        {
            OrderByColumn orderByColumn = (OrderByColumn)
View Full Code Here

     * We assume the System boot process has created a context
     * manager already, but not that contexts we need are there.
     */
    ContextService csf = ContextService.getFactory();

    ContextManager cm = csf.getCurrentContextManager();
    if (SanityManager.DEBUG)
      SanityManager.ASSERT((cm != null), "Failed to get current ContextManager");

    // RESOLVE other non-StandardException errors.
    bootingTC = null;
    try
    {
      // Get a transaction controller. This has the side effect of
      // creating a transaction context if there isn't one already.
      bootingTC = af.getTransaction(cm);

      /*
        We need an execution context so that we can generate rows
        REMIND: maybe only for create case?
       */
      exFactory.newExecutionContext(cm);

      DataDescriptorGenerator ddg = getDataDescriptorGenerator();

      //We should set the user schema collation type here now because
      //later on, we are going to create user schema APP. By the time any
      //user schema gets created, we should have the correct collation
      //type set for such schemas to use. For this reason, don't remove
      //the following if else statement and don't move it later in this
      //method.
      String userDefinedCollation;   
      if (create) {
        // Get the collation attribute from the JDBC url. It can only have one of
        // 2 possible values - UCS_BASIC or TERRITORY_BASED
        // This attribute can only be specified at database create time.
        userDefinedCollation = startParams.getProperty(Attribute.COLLATION);   
        if (userDefinedCollation == null)
          userDefinedCollation = Property.UCS_BASIC_COLLATION;
        else {//Invalid value handling
          if (!userDefinedCollation.equalsIgnoreCase(Property.UCS_BASIC_COLLATION)
              && !userDefinedCollation.equalsIgnoreCase(Property.TERRITORY_BASED_COLLATION))
            throw StandardException.newException(SQLState.INVALID_COLLATION, userDefinedCollation);
          }
        bootingTC.setProperty(Property.COLLATION,userDefinedCollation,true);
      } else {
        userDefinedCollation = startParams.getProperty(Property.COLLATION);
        if (userDefinedCollation == null)
          userDefinedCollation = Property.UCS_BASIC_COLLATION;
      }

      //Initialize the collation type of user schemas after looking at
      //collation property/attribute.
      if (userDefinedCollation.equalsIgnoreCase(Property.UCS_BASIC_COLLATION))
        collationTypeOfUserSchemas = StringDataValue.COLLATION_TYPE_UCS_BASIC;
      else
        collationTypeOfUserSchemas = StringDataValue.COLLATION_TYPE_TERRITORY_BASED;

      //Now is also a good time to create schema descriptor for global
      //temporary tables. Since this is a user schema, it should use the
      //collation type associated with user schemas. Since we just
      //finished setting up the collation type of user schema, it is
      //safe to create user SchemaDescriptor(s) now.
      declaredGlobalTemporaryTablesSchemaDesc =
              newDeclaredGlobalTemporaryTablesSchemaDesc(
                      SchemaDescriptor.STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME);
     
      if (create) {
        String userName = IdUtil.getUserNameFromURLProps(startParams);
        authorizationDatabaseOwner = IdUtil.getUserAuthorizationId(userName);
     
        // create any required tables.
        createDictionaryTables(startParams, bootingTC, ddg);
        //create procedures for network server metadata
        create_SYSIBM_procedures(bootingTC);
        //create metadata sps statement required for network server
        createSystemSps(bootingTC);
                // create the SYSCS_UTIL system procedures)
                create_SYSCS_procedures(bootingTC);
        // log the current dictionary version
        dictionaryVersion = softwareVersion;

        /* Set properties for current and create time
         * DataDictionary versions.
         */
        bootingTC.setProperty(
                    DataDictionary.CORE_DATA_DICTIONARY_VERSION,
                    dictionaryVersion, true);

        bootingTC.setProperty(
                    DataDictionary.CREATE_DATA_DICTIONARY_VERSION,
                    dictionaryVersion, true);

        // If SqlAuthorization is set as system property during database
        // creation, set it as database property also, so it gets persisted.
        if (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY))
        {
          bootingTC.setProperty(Property.SQL_AUTHORIZATION_PROPERTY,"true",true);
          usesSqlAuthorization=true;
        }
      } else {
        // Get the ids for non-core tables
        loadDictionaryTables(bootingTC, ddg, startParams);
        SchemaDescriptor sd = locateSchemaRow(SchemaDescriptor.IBM_SYSTEM_SCHEMA_NAME,
                 bootingTC);
        authorizationDatabaseOwner = sd.getAuthorizationId();
        String sqlAuth = PropertyUtil.getDatabaseProperty(bootingTC,
                    Property.SQL_AUTHORIZATION_PROPERTY);

        // Feature compatibility check.
        if (Boolean.valueOf
            (startParams.getProperty(
              Attribute.SOFT_UPGRADE_NO_FEATURE_CHECK))
            .booleanValue()) {
          // Do not perform check if this boot is the first
          // phase (soft upgrade boot) of a hard upgrade,
          // which happens in two phases beginning with
          // DERBY-2264. In this case, we need to always be
          // able to boot to authenticate, notwithstanding
          // any feature properties set
          // (e.g. derby.database.sqlAuthorization) which
          // may not yet be supported until that hard
          // upgrade has happened, normally causing an error
          // below.
          //
          // Feature sqlAuthorization is a special case:
          // Since database ownership checking only happens
          // when sqlAuthorization is true, we can't afford
          // to *not* use it for upgrades from 10.2 or
          // later, lest we lose the database owner check.
          // For upgrades from 10.1 and earlier there is no
          // database owner check at a hard upgrade.
          if (dictionaryVersion.majorVersionNumber >=
            DataDictionary.DD_VERSION_DERBY_10_2) {
            usesSqlAuthorization = Boolean.valueOf(sqlAuth).
              booleanValue();
          }
        } else {
          if (Boolean.valueOf(sqlAuth).booleanValue()) {
            // SQL authorization requires 10.2 or higher database
            checkVersion(DataDictionary.DD_VERSION_DERBY_10_2,
                   "sqlAuthorization");
            usesSqlAuthorization=true;
          }
        }
      }
         
      if (SanityManager.DEBUG)
        SanityManager.ASSERT((authorizationDatabaseOwner != null), "Failed to get Database Owner authorization");

      /* Commit & destroy the create database */
      bootingTC.commit();
      cm.getContext(ExecutionContext.CONTEXT_ID).popMe(); // done with ctx
    } finally {

      if (bootingTC != null) {
        bootingTC.destroy()// gets rid of the transaction context
        bootingTC = null;
View Full Code Here

    String thisTestName = aTest.getClass().getName();
    Date startTime = null, endTime;

    // push a new context manager
    ContextManager cm = null;
    if (contextService != null) {
      cm = contextService.newContextManager();
      contextService.setCurrentContextManager(cm);
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.context.ContextManager

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.