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

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


    DataDictionary  dd = getDataDictionary();
    /*
    ** Grab the current schema.  We will use that for
    ** sps compilation
    */
    LanguageConnectionContext lcc = getLanguageConnectionContext();
    compSchemaDescriptor = lcc.getDefaultSchema();

    /*
    ** Get and check the schema descriptor for this
    ** trigger.  This check will throw the proper exception
    ** if someone tries to create a trigger in the SYS
    ** schema.
    */
    triggerSchemaDescriptor = getSchemaDescriptor();

    /*
    ** Get the trigger table.
    */
    triggerTableDescriptor = getTableDescriptor(tableName);

    //throw an exception if user is attempting to create a trigger on a temporary table
    if (isSessionSchema(triggerTableDescriptor.getSchemaDescriptor()))
    {
        throw StandardException.newException(SQLState.LANG_OPERATION_NOT_ALLOWED_ON_SESSION_SCHEMA_TABLES);
    }
    if (isPrivilegeCollectionRequired())
    {
      compilerContext.pushCurrentPrivType(Authorizer.TRIGGER_PRIV);
      compilerContext.addRequiredTablePriv(triggerTableDescriptor);
      compilerContext.popCurrentPrivType();     
    }

    /*
    ** Regenerates the actionText and actionNode if necessary.
    */
    boolean needInternalSQL = bindReferencesClause(dd);

    lcc.pushTriggerTable(triggerTableDescriptor);
    try
   
      /*
      ** Bind the trigger action and the trigger
      ** when clause to make sure that they are
      ** ok.  Note that we have already substituted
      ** in various replacements for OLD/NEW transition
      ** tables/variables and reparsed if necessary.
      */
      if (needInternalSQL)
        compilerContext.setReliability(CompilerContext.INTERNAL_SQL_LEGAL);
     
      // For before triggers, the action statement cannot contain calls
      // to procedures that modify SQL data. If the action statement
      // contains a procedure call, this reliability will be used during
      // bind of the call statement node.
      if(isBefore)
        compilerContext.setReliability(CompilerContext.MODIFIES_SQL_DATA_PROCEDURE_ILLEGAL);
         
      actionNode.bindStatement();

      /* when clause is always null
      if (whenClause != null)
      {
        whenClause.bind();
      }
      */
    }
    finally
    {
      lcc.popTriggerTable(triggerTableDescriptor);
    }

    /*
    ** Statement is dependent on the TableDescriptor
    */
 
View Full Code Here


  {
    try
    {
      if (!initialized)
      {
        LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();

        tc = lcc.getTransactionExecute();
        LockFactory lf = tc.getAccessManager().getLockFactory();
        lockTable = lf.makeVirtualLockTable();
        initialized = true;
        tabInfo = new TableNameInfo(lcc, true);
      }
View Full Code Here

        sc.addDependency(dy);
      }
      else
      {
        /* Add a stored dependency */
        LanguageConnectionContext  lcc = getLanguageConnectionContext(cm);
        DependencyDescriptor    dependencyDescriptor;
        boolean wait = (tc == null);
     
        dependencyDescriptor = new DependencyDescriptor(d, p);

        /* We can finally call the DataDictionary to store the dependency */
        dd.addDescriptor(dependencyDescriptor, null,
                 DataDictionary.SYSDEPENDS_CATALOG_NUM, true,
                 ((wait)?lcc.getTransactionExecute():tc), wait);
      }
    }
  }
View Full Code Here

    )
    throws StandardException
  {
    Parser            p;
    ValueNode          defaultTree;
    LanguageConnectionContext  lcc = getLanguageConnectionContext();
    CompilerContext       compilerContext = getCompilerContext();

    /* Get a Statement to pass to the parser */

    /* We're all set up to parse. We have to build a compilable SQL statement
     * before we can parse -  So, we goober up a VALUES defaultText.
     */
    String values = "VALUES " + defaultText;
   
    /*
    ** Get a new compiler context, so the parsing of the select statement
    ** doesn't mess up anything in the current context (it could clobber
    ** the ParameterValueSet, for example).
    */
    CompilerContext newCC = lcc.pushCompilerContext();

    p = newCC.getParser();
       
    /* Finally, we can call the parser */
    // Since this is always nested inside another SQL statement, so topLevel flag
    // should be false
    StatementNode qt = p.parseStatement(values);
    if (SanityManager.DEBUG)
    {
      if (! (qt instanceof CursorNode))
      {
        SanityManager.THROWASSERT(
          "qt expected to be instanceof CursorNode, not " +
          qt.getClass().getName());
      }
      CursorNode cn = (CursorNode) qt;
      if (! (cn.getResultSetNode() instanceof RowResultSetNode))
      {
        SanityManager.THROWASSERT(
          "cn.getResultSetNode() expected to be instanceof RowResultSetNode, not " +
          cn.getResultSetNode().getClass().getName());
      }
    }

    defaultTree = ((ResultColumn)
              ((CursorNode) qt).getResultSetNode().getResultColumns().elementAt(0)).
                  getExpression();

    lcc.popCompilerContext(newCC);

    return  defaultTree;
  }
View Full Code Here

    finished = false;

    attachStatementContext();

    try {
      LanguageConnectionContext lcc = getLanguageConnectionContext();
      if(lcc.getRunTimeStatisticsMode() && lcc.getXplainOnlyMode()) {
        // do nothing
      } else {
        openCore();
      }
View Full Code Here

   *
   * @return the next row in the result
   */
  public final ExecRow  getNextRow() throws StandardException
  {
    LanguageConnectionContext lcc = getLanguageConnectionContext();
    if(lcc.getRunTimeStatisticsMode() && lcc.getXplainOnlyMode()){
      // return null to indicate no results available and
      // to bypass the execution
      return null;
    }
   
View Full Code Here

     */
  public void checkCancellationFlag()
        throws
            StandardException
  {
        LanguageConnectionContext lcc = getLanguageConnectionContext();
        StatementContext localStatementContext = lcc.getStatementContext();
        if (localStatementContext == null) {
            return;
        }

    InterruptStatus.throwIf(lcc);
View Full Code Here

  private GenericPreparedStatement currentPs;
  private boolean wasNull;

  public StatementCache() throws SQLException {

    LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
       
        CacheManager statementCache =
            lcc.getLanguageConnectionFactory().getStatementCache();

    if (statementCache != null) {
      final Collection values = statementCache.values();
      data = new Vector(values.size());
      for (Iterator i = values.iterator(); i.hasNext(); ) {
View Full Code Here

    /** Returns the default value for the transaction timeout in milliseconds
     *  setted up by the system properties.
     */
    private long getDefaultXATransactionTimeout() throws XAException {
        try {
            LanguageConnectionContext lcc = con.getLanguageConnection();
            TransactionController tc = lcc.getTransactionExecute();

            long timeoutMillis = 1000 * (long) PropertyUtil.getServiceInt(
                tc,
                Property.PROP_XA_TRANSACTION_TIMEOUT,
                0,
View Full Code Here

        // don't allow overriding of generation clauses
        forbidGenerationOverrides( resultSet.getResultColumns(),
                   addedGeneratedColumns );
       
    LanguageConnectionContext lcc = getLanguageConnectionContext();
    if (lcc.getAutoincrementUpdate() == false)
      resultSet.getResultColumns().forbidOverrides(null);

    /*
    ** Mark the columns in this UpdateNode's result column list as
    ** updateable in the ResultColumnList of the table being updated.
View Full Code Here

TOP

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

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.