Package org.apache.derby.iapi.sql.conn

Examples of org.apache.derby.iapi.sql.conn.SQLSessionContext


        Activation parent = activation.getParentActivation();
        SchemaDescriptor defaultSchema = getInitialDefaultSchemaDescriptor();

        // walk SQL session context chain
        while (parent != null) {
            SQLSessionContext ssc = parent.getSQLSessionContextForChildren();
            SchemaDescriptor s = ssc.getDefaultSchema();

            if (SanityManager.DEBUG) {
                SanityManager.ASSERT(s != null, "s should not be empty here");
            }

            if (schemaName.equals(s.getSchemaName())) {
                ssc.setDefaultSchema(defaultSchema);
            }
            parent = parent.getParentActivation();
        }

        // finally top level
        SQLSessionContext top = getTopLevelSQLSessionContext();
        SchemaDescriptor sd = top.getDefaultSchema();

        if (SanityManager.DEBUG) {
            SanityManager.ASSERT(sd != null, "sd should not be empty here");
        }

        if (schemaName.equals(sd.getSchemaName())) {
            top.setDefaultSchema(defaultSchema);
        }
    }
View Full Code Here


     * Return the current SQL session context of the activation
     *
     * @param activation the activation
     */
    private SQLSessionContext getCurrentSQLSessionContext(Activation activation) {
        SQLSessionContext curr;

        Activation parent = activation.getParentActivation();

        if (parent == null ) {
            // top level
View Full Code Here

    /**
     * Return the current SQL session context based on statement context
     */
    private SQLSessionContext getCurrentSQLSessionContext() {
        StatementContext ctx = getStatementContext();
        SQLSessionContext curr;

        if (ctx == null || !ctx.inUse()) {
            curr = getTopLevelSQLSessionContext();
        } else {
            // We are inside a nested connection in a procedure of
View Full Code Here

            if (definersRights) {
                SanityManager.ASSERT(push);
            }
        }

        SQLSessionContext sc = a.setupSQLSessionContextForChildren(push);

        if (definersRights) {
            sc.setUser(definer);
        } else {
            // A priori: invoker's rights: Current user
            sc.setUser(getCurrentUserId(a));
        }


        if (definersRights) {
            // No role a priori. Cf. SQL 2008, section 10.4 <routine
            // invocation>, GR 5 j) i) 1) B) "If the external security
            // characteristic of R is DEFINER, then the top cell of the
            // authorization stack of RSC is set to contain only the routine
            // authorization identifier of R.

            sc.setRole(null);
        } else {
            // Semantics for roles dictate (SQL 4.34.1.1 and 4.27.3.) that the
            // role is initially inherited from the current session context
            // when we run with INVOKER security characteristic.
            sc.setRole(getCurrentRoleId(a));
        }


        if (definersRights) {
            SchemaDescriptor sd = getDataDictionary().getSchemaDescriptor(
                definer,
                getTransactionExecute(),
                false);

            if (sd == null) {
                sd = new SchemaDescriptor(
                    getDataDictionary(), definer, definer, (UUID) null, false);
            }

            sc.setDefaultSchema(sd);
        } else {
            // Inherit current default schema. The initial value of the
            // default schema is implementation defined. In Derby we
            // inherit it when we invoke stored procedures and functions.
            sc.setDefaultSchema(getDefaultSchema(a));
        }

        StatementContext stmctx = getStatementContext();

        // Since the statement is an invocation (iff push=true), it will now be
View Full Code Here

    Activation parent = activation.getParentActivation();
    SchemaDescriptor defaultSchema = getInitialDefaultSchemaDescriptor();

    // walk SQL session context chain
    while (parent != null) {
      SQLSessionContext ssc = parent.getSQLSessionContextForChildren();
      SchemaDescriptor s = ssc.getDefaultSchema();

      if (SanityManager.DEBUG) {
        SanityManager.ASSERT(s != null, "s should not be empty here");
      }

      if (schemaName.equals(s.getSchemaName())) {
        ssc.setDefaultSchema(defaultSchema);
      }
      parent = parent.getParentActivation();
    }

    // finally top level
    SQLSessionContext top = getTopLevelSQLSessionContext();
    SchemaDescriptor sd = top.getDefaultSchema();

    if (SanityManager.DEBUG) {
      SanityManager.ASSERT(sd != null, "sd should not be empty here");
    }

    if (schemaName.equals(sd.getSchemaName())) {
      top.setDefaultSchema(defaultSchema);
    }
  }
View Full Code Here

   * Return the current SQL session context of the activation
   *
   * @param activation the activation
   */
  private SQLSessionContext getCurrentSQLSessionContext(Activation activation) {
    SQLSessionContext curr;

    Activation parent = activation.getParentActivation();

    if (parent == null ) {
      // top level
View Full Code Here

  /**
   * Return the current SQL session context based on statement context
   */
  private SQLSessionContext getCurrentSQLSessionContext() {
    StatementContext ctx = getStatementContext();
    SQLSessionContext curr;

    if (ctx == null || !ctx.inUse()) {
      curr = getTopLevelSQLSessionContext();
    } else {
      // We are inside a nested connection in a procedure of
View Full Code Here

    setupSessionContextMinion(a, true);
  }

  private void setupSessionContextMinion(Activation a,
                         boolean push) {
    SQLSessionContext sc = a.setupSQLSessionContextForChildren(push);

    // Semantics for roles dictate (SQL 4.34.1.1 and 4.27.3.) that the
    // role is initially inherited from the current session
    // context. (Since we always run with INVOKER security
    // characteristic. Derby can't yet run with DEFINER's rights).
    //
    sc.setRole(getCurrentRoleId(a));

    // Inherit current default schema. The initial value of the
    // default schema is implementation defined. In Derby we
    // inherit it when we invoke stored procedures and functions.
    sc.setDefaultSchema(getDefaultSchema(a));

    StatementContext stmctx = getStatementContext();

    // Since the statement is an invocation (iff push=true), it will now be
    // associated with the pushed SQLSessionContext (and no longer just
View Full Code Here

    Activation parent = activation.getParentActivation();
    SchemaDescriptor defaultSchema = getInitialDefaultSchemaDescriptor();

    // walk SQL session context chain
    while (parent != null) {
      SQLSessionContext ssc = parent.getSQLSessionContextForChildren();
      SchemaDescriptor s = ssc.getDefaultSchema();

      if (SanityManager.DEBUG) {
        SanityManager.ASSERT(s != null, "s should not be empty here");
      }

      if (schemaName.equals(s.getSchemaName())) {
        ssc.setDefaultSchema(defaultSchema);
      }
      parent = parent.getParentActivation();
    }

    // finally top level
    SQLSessionContext top = getTopLevelSQLSessionContext();
    SchemaDescriptor sd = top.getDefaultSchema();

    if (SanityManager.DEBUG) {
      SanityManager.ASSERT(sd != null, "sd should not be empty here");
    }

    if (schemaName.equals(sd.getSchemaName())) {
      top.setDefaultSchema(defaultSchema);
    }
  }
View Full Code Here

   * Return the current SQL session context of the activation
   *
   * @param activation the activation
   */
  private SQLSessionContext getCurrentSQLSessionContext(Activation activation) {
    SQLSessionContext curr;

    Activation parent = activation.getParentActivation();

    if (parent == null ) {
      // top level
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.conn.SQLSessionContext

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.