コード例 #1
0
ComDiagsArea *ExRaiseSqlError(CollHeap* heap, ex_queue_entry* req,
			      ExeErrorCode err, 
			      Lng32 * intParam1,
			      char * stringParam1,
			      ComCondition** newCond)
{
  ComDiagsArea* da = req->getDiagsArea();
  if (da == NULL)
    da = ComDiagsArea::allocate(heap);
  else
    da = da->copy();
  
  return ExRaiseSqlError(heap, &da, (ExeErrorCode)(-err), newCond, intParam1, NULL, NULL, stringParam1);
}
コード例 #2
0
void ex_queue::injectErrorOrCancel()
{
#ifdef _DEBUG
  ex_queue_entry *qe = getQueueEntry(tail_-1);

  // DO the ol' switcheroo, but not every time.
  ULng32 freq = insertSubtask_->getTcb()->getGlobals()->getInjectErrorAtQueue();
  if (freq == 0)
      return;
  if (upDown_ == UP_QUEUE)
    {
       if ((rand() & (freq-1)) != 0)
         return;
        NABoolean needsError = FALSE;
        switch (qe->upState.status)
        {
        case Q_OK_MMORE:
          {
            needsError = TRUE;
            qe->upState.status = Q_SQLERROR;
            cerr << "Converting a Q_OK_MMORE to a Q_SQLERROR, from "
                 << NodeTypeToString(unblockSubtask_->getTcb()->getNodeType())
                 << "(" << unblockSubtask_->getTcb() << ")" 
                 << " to "
                 << NodeTypeToString(insertSubtask_->getTcb()->getNodeType())
                 << "(" << insertSubtask_->getTcb() << ")" 
                 << endl;
            break;
          }
        case Q_NO_DATA:
          if (!isFull())
            {
              needsError = TRUE;
              qe->upState.status = Q_SQLERROR;
              ex_queue_entry *newQNODATA = getTailEntry();
              newQNODATA->upState = qe->upState;
              newQNODATA->upState.status  = Q_NO_DATA;
              newQNODATA->getAtp()->copyAtp(qe->getAtp());
              tail_++;
              cerr << "Injecting a Q_SQLERROR before a Q_NO_DATA, from " 
                 << NodeTypeToString(unblockSubtask_->getTcb()->getNodeType())
                 << "(" << unblockSubtask_->getTcb() << ")" 
                 << " to "
                 << NodeTypeToString(insertSubtask_->getTcb()->getNodeType())
                 << "(" << insertSubtask_->getTcb() << ")" 
                 << endl;
            }
          break;
        default:
            break;
        } 
        if (needsError)
          {
            ComDiagsArea * da = qe->getDiagsArea();
            if (!da) 
              da = ComDiagsArea::allocate(insertSubtask_->getTcb()->getHeap());
            else
              da = da->copy();
            qe->setDiagsArea(da);

            *da << DgSqlCode(-EXE_ERROR_INJECTED)
                << DgString0(__FILE__)
                << DgInt0(__LINE__);
          }
    }
#endif

  return;
}