Examples of CursorResultSet


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

    boolean        foundMatch = false;
    Object[]       checkRowArray = checkRow.getRowArray();
    DataValueDescriptor  checkCol;
    DataValueDescriptor  scanCol;

    CursorResultSet rs = rowHolder.getResultSet();
    try
   
      /*
      ** For each inserted row
      */ 
      rs.open();
      while ((scanRow = rs.getNextRow()) != null)
      {
        Object[] scanRowArray = scanRow.getRowArray();
        int i;
        for (i = 0; i < colsToCheck.length; i++)
        {
          checkCol = (DataValueDescriptor)checkRowArray[colsToCheck[i]-1];
          scanCol = (DataValueDescriptor)scanRowArray[colsToCheck[i]-1];

          BooleanDataValue result = checkCol.equals(
                      scanCol,
                      checkCol); // result
          if (!result.getBoolean())
          {
            break;
          }
        }
        if (i == colsToCheck.length)
        {
          foundMatch = true;
          break;
       
      }
    }
    finally
    {
      rs.close();
    }
    return foundMatch;
  }
View Full Code Here

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

        triggerActivator.notifyEvent(TriggerEvents.BEFORE_INSERT,
                        (CursorResultSet)null,
                        rowHolder.getResultSet());
      }

      CursorResultSet rs = rowHolder.getResultSet();
      try
      {
        rs.open();
        while ((deferredRowBuffer = rs.getNextRow()) != null)
        {
          // we have to set the source row so the check constraint
          // sees the correct row.
          sourceResultSet.setCurrentRow(deferredRowBuffer);
          evaluateCheckConstraints();
          rowChanger.insertRow(deferredRowBuffer);
        }
      } finally
      {
        sourceResultSet.clearCurrentRow();
        rs.close();
      }
     
      if (fkChecker != null)
      {
        /*
        ** Second scan to make sure all the foreign key
        ** constraints are ok.  We have to do this after
        ** we have completed the inserts in case of self
        ** referencing constraints.
        */
        rs = rowHolder.getResultSet();
        try
        {
          rs.open();
          while ((deferredRowBuffer = rs.getNextRow()) != null)
          {
            fkChecker.doFKCheck(deferredRowBuffer);
          }
        } finally
        {
          rs.close();
        }
      }

      // fire AFTER trigger
      if (triggerActivator != null)
View Full Code Here

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

    ** If it's a deferred insert, scan the temporary conglomerate and
    ** insert the rows into the permanent conglomerates using rowChanger.
    */
    if (constants.deferred)
    {
      CursorResultSet tempRS = rowHolder.getResultSet();
      try
      {
        tempRS.open();
        while ((row = tempRS.getNextRow()) != null)
        {
          insertIntoVTI(rs, row);
        }
      } finally
      {
        sourceResultSet.clearCurrentRow();
        tempRS.close();
      }
    }

    if (rowHolder != null)
    {
View Full Code Here

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

    ** If it's a deferred update, scan the temporary conglomerate and
    ** insert the rows into the VTI using rowChanger.
    */
    if (constants.deferred)
    {
      CursorResultSet tempRS = rowHolder.getResultSet();
      try
      {
        tempRS.open();
        while ((row = tempRS.getNextRow()) != null)
        {
                    int rowNumber = row.getColumn( rowLocationColumn).getInt();
                    rs.absolute( rowNumber);
          updateVTI(rs, row);
        }
      }
            catch (Throwable t)
            {
                throw StandardException.unexpectedUserException(t);
            }
            finally
      {
        sourceResultSet.clearCurrentRow();
        tempRS.close();
      }
    }

    if (rowHolder != null)
    {
View Full Code Here

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

          //skipping the row holder that  we are copying the rows into.
          rowHolderId++;
          continue;
        }
        TemporaryRowHolder currentRowHolder = (TemporaryRowHolder)sVector.elementAt(rowHolderId)
        CursorResultSet rs = currentRowHolder.getResultSet();
        rs.open();
        while ((row = rs.getNextRow()) != null)
        {
          rowHolder.insert(row);
        }
        rs.close();
        rowHolderId++;
      }
     
    }
  }
View Full Code Here

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

                        (CursorResultSet)null,
                        rowHolder.getResultSet(),
                        (int[])null);
      }

      CursorResultSet rs = rowHolder.getResultSet();
      try
      {
        rs.open();
        while ((deferredRowBuffer = rs.getNextRow()) != null)
        {
          // we have to set the source row so the check constraint
          // sees the correct row.
          sourceResultSet.setCurrentRow(deferredRowBuffer);
          evaluateCheckConstraints();
          rowChanger.insertRow(deferredRowBuffer);
        }
      } finally
      {
        sourceResultSet.clearCurrentRow();
        rs.close();
      }
     
      if (fkChecker != null)
      {
        /*
        ** Second scan to make sure all the foreign key
        ** constraints are ok.  We have to do this after
        ** we have completed the inserts in case of self
        ** referencing constraints.
        */
        rs = rowHolder.getResultSet();
        try
        {
          rs.open();
          while ((deferredRowBuffer = rs.getNextRow()) != null)
          {
            fkChecker.doFKCheck(deferredRowBuffer);
          }
        } finally
        {
          rs.close();
        }
      }

      // fire AFTER trigger
      if (triggerActivator != null)
View Full Code Here

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

    ** If it's a deferred insert, scan the temporary conglomerate and
    ** insert the rows into the permanent conglomerates using rowChanger.
    */
    if (constants.deferred)
    {
      CursorResultSet tempRS = rowHolder.getResultSet();
      try
      {
        tempRS.open();
        while ((row = tempRS.getNextRow()) != null)
        {
          insertIntoVTI(rs, row);
        }
      } finally
      {
        sourceResultSet.clearCurrentRow();
        tempRS.close();
      }
    }

    if (rowHolder != null)
    {
View Full Code Here

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

                lockMode,
                TransactionController.ISOLATION_SERIALIZABLE,
                constants.heapSCOCI,
                heapDCOCI);
     
    CursorResultSet rs = rowHolder.getResultSet();
    try
    {
      /*
      ** We need to do a fetch doing a partial row
      ** read.  We need to shift our 1-based bit
      ** set to a zero based bit set like the store
      ** expects.
      */
      FormatableBitSet readBitSet = RowUtil.shift(baseRowReadList, 1);

      rs.open();
            while ((defRLRow = rs.getNextRow()) != null)
      {
                rlColumn = defRLRow.getColumn(rlColumnNumber);
        baseRowLocation =
          (RowLocation) (rlColumn).getObject();
 
        /* Get the base row at the given RowLocation */
        boolean row_exists =
          deferredBaseCC.fetch(
                     baseRowLocation, deferredSparseRow.getRowArray(),
                     readBitSet);

        // In case of cascade delete , things like before triggers can delete
        // the rows before the dependent result get a chance to delete
        if(cascadeDelete && !row_exists)
          continue;

        if (SanityManager.DEBUG)
        {
          if (!row_exists)
          {
                          SanityManager.THROWASSERT("could not find row "+baseRowLocation);
          }
        }
 
        rc.deleteRow(deferredBaseRow, baseRowLocation);
        source.markRowAsDeleted();
      }
    } finally
    {
        rs.close();
    }
  }
View Full Code Here

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

      ** Second scan to make sure all the foreign key
      ** constraints are ok.  We have to do this after
      ** we have completed the deletes in case of self referencing
      ** constraints.
      */
      CursorResultSet rs = rowHolder.getResultSet();
      try
      {
        rs.open();

                ExecRow defRLRow;

                while ((defRLRow = rs.getNextRow()) != null)
        {
                    // Argument "1" below: If a PK referenced by an FK is
                    // deferred, require at least one to be present in the
                    // primary table since we have deleted the row unless
                    // postCheck == true, in which the call to postChecks does
                    // the actual checking, and we need at least one to fulfill
                    // the constraint.
                    fkChecker.doPKCheck(
                            activation,
                            defRLRow,
                            restrictCheckOnly,
                            1);
        }

                if (restrictCheckOnly) {
                    fkChecker.postCheck();
                }

      } finally
      {
        rs.close();
      }
    }
  }
View Full Code Here

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

      return null;
    }

    try
    {
      CursorResultSet brs = beforeResultSet;
      /* We should really shallow clone the result set, because it could be used
       * at multiple places independently in trigger action.  This is a bug found
       * during the fix of beetle 4373.
       */
      if (brs instanceof TemporaryRowHolderResultSet)
        brs = (CursorResultSet) ((TemporaryRowHolderResultSet) brs).clone();
      else if (brs instanceof TableScanResultSet)
        brs = (CursorResultSet) ((TableScanResultSet) brs).clone();
      brs.open();
      java.sql.ResultSet rs = cc.getResultSet(brs);
      resultSetVector.addElement(rs);
      return rs;
    } catch (StandardException se)
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.