Package org.apache.derby.iapi.sql.execute

Examples of org.apache.derby.iapi.sql.execute.ExecRow


     * a right outer join.  (Result columns ordered according to
     * original query.)
     */
    if (wasRightOuterJoin)
    {
      ExecRow tmp;

      tmp = leftRow;
      leftRow = rightRow;
      rightRow = tmp;
      leftNumCols = this.rightNumCols;
View Full Code Here


   *
   * @exception StandardException thrown on failure to get next row
   */
  public ExecRow getNextRowCore() throws StandardException
  {
      ExecRow result = null;
    Object[] columns = null;

    beginTime = getCurrentTimeMillis();
      if ( isOpen )
      {
View Full Code Here

   * @exception StandardException on error
   */
  public DataValueDescriptor[] getNextRowFromRowSource()
    throws StandardException
  {
    ExecRow execRow = getNextRowCore();
     if (execRow != null)
    {
      /* Let the target preprocess the row.  For now, this
       * means doing an in place clone on any indexed columns
       * to optimize cloning and so that we don't try to drain
       * a stream multiple times.  This is where we also
       * enforce any check constraints.
       */
      clonedExecRow = targetResultSet.preprocessSourceRow(execRow);

      return execRow.getRowArray();
    }

    return null;
  }
View Full Code Here

    public ExecRow getNextRowCore() throws StandardException
    {
        checkCancellationFlag();

        // Step 1.
        ExecRow result = super.getNextRowCore();

        // Steps 2, 1, 2, 1, 2, ...
        while ((result == null) && moreInListVals())
        {
            /* Repositioning the scan (if needed) is simply a matter of
View Full Code Here

  {
    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 |
View Full Code Here

  private ScanController loadSorter()
    throws StandardException
  {
    SortController       sorter;
    long           sortId;
    ExecRow         sourceRow;
    ExecRow          inputRow;
    boolean          inOrder = (order.length == 0 || isInSortedOrder);
    int            inputRowCountEstimate = (int) optimizerEstimatedRowCount;

    // find the language context and
        // Get the current transaction controller
    TransactionController tc = getTransactionController();
    sortId = tc.createSort((Properties)null,
            sortTemplateRow.getRowArray(),
            order,
            observer,
            inOrder,
            inputRowCountEstimate, // est rows
             maxRowSize      // est rowsize
            );
    sorter = tc.openSort(sortId);
    genericSortId = sortId;
    dropGenericSort = true;
 
    /* The sorter is responsible for doing the cloning */
    while ((inputRow = getNextRowFromRS()) != null)
    {
      /* The sorter is responsible for doing the cloning */
      sorter.insert(inputRow.getRowArray());
    }
    source.close();
    sortProperties = sorter.getSortInfo().getAllSortInfo(sortProperties);
    sorter.completedInserts();

View Full Code Here

        rowsReturned++;
        setCurrentRow(currSortedRow);
        return currSortedRow;
      }

        ExecRow sortResult = getNextRowFromRS();

      /* Drain and throw away rows until we find a new distinct row. */
      while (sortResult != null)
      {
        /* We found a new row.  Update the current row and return this one. */
        if (! filterRow(currSortedRow, sortResult))
        {
          /* Save a clone of the new row so that it doesn't get overwritten */
          currSortedRow = (ExecRow) sortResult.getClone();
          setCurrentRow(currSortedRow);
          nextTime += getElapsedMillis(beginTime);
          rowsReturned++;
          return currSortedRow;
        }

        // Get the next row
        sortResult = getNextRowFromRS();
      }

      // We've drained the source, so no more rows to return
      currSortedRow = null;
      nextTime += getElapsedMillis(beginTime);
      return null;
    }
    else
    {
        ExecRow sortResult = getNextRowFromRS();

      if (sortResult != null)
      {
        setCurrentRow(sortResult);
        rowsReturned++;
View Full Code Here

   * Get a row from the input result set. 
   */ 
  private ExecRow getRowFromResultSet()
    throws StandardException
  {
    ExecRow        sourceRow;
    ExecRow      inputRow = null

    if ((sourceRow = source.getNextRowCore()) != null)
    {
      rowsInput++;
      inputRow = sourceRow;
View Full Code Here

   * sets currentRow.
   */
  private ExecRow getRowFromSorter()
    throws StandardException
  {
    ExecRow      inputRow = null
   
    if (scanController.next())
    {
      // REMIND: HACKALERT we are assuming that result will
      // point to what sortResult is manipulating when
      // we complete the fetch.
      currentRow = sortResultRow;

      inputRow = sortResultRow;

      scanController.fetch(inputRow.getRowArray());
    }
    return inputRow;
  }
View Full Code Here

   *
   * @exception StandardException thrown on failure to open
  */
  public void  openCore() throws StandardException
  {
    ExecRow candidateCopy = candidate.getClone();

    beginTime = getCurrentTimeMillis();
    if (SanityManager.DEBUG)
    {
        SanityManager.ASSERT(!isOpen, "LastIndexKeyResultSet already open");
    }

    isOpen = true;
    TransactionController tc = activation.getTransactionController();

    initIsolationLevel();

    /*
    ** Grab the last row.  Note that if there are deletes
    ** left lying around and no real row to return, then
    ** the row array gets set even though the scan doesn't
    ** return a row, so be careful to handle this correctly.
    */
    if (tc.fetchMaxOnBtree(
          conglomId,  // conglomerate to open
          0,       // open mode
          lockMode,
          isolationLevel,
          accessedCols,
          candidateCopy.getRowArray()))
    {
      currentRow =
        getCompactRow(candidateCopy, accessedCols, (FormatableBitSet) null, true);
      setCurrentRow(currentRow);
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.execute.ExecRow

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.