short ExExeUtilAQRTcb::work() { // if no parent request, return if (qparent_.down->isEmpty()) return WORK_OK; ex_queue_entry * pentry_down = qparent_.down->getHeadEntry(); ExExeUtilPrivateState & pstate = *((ExExeUtilPrivateState*) pentry_down->pstate); ContextCli *currContext = getGlobals()->castToExExeStmtGlobals()->castToExMasterStmtGlobals()-> getStatement()->getContext(); AQRInfo * aqr = currContext->aqrInfo(); while (1) { switch (step_) { case EMPTY_: { if (aqrTdb().getTask() == ComTdbExeUtilAQR::GET_) { // GET aqr entries and display them aqr->position(); step_ = RETURN_HEADER_; } else { step_ = SET_ENTRY_; } } break; case SET_ENTRY_: { if (aqr->setAQREntry(aqrTdb().getTask(), aqrTdb().sqlcode_, aqrTdb().nskcode_, aqrTdb().retries_, aqrTdb().delay_, aqrTdb().type_, 0, NULL, 0, 0)) { // error step_ = HANDLE_ERROR_; break; } step_ = DONE_; } break; case RETURN_HEADER_: { // if no room in up queue for 4 display rows, // won't be able to return data/status. // Come back later. if ((qparent_.up->getSize() - qparent_.up->getLength()) < 5) return -1; moveRowToUpQueue(" "); moveRowToUpQueue(" SQLCODE PLATFORMERROR RETRIES DELAY TYPE "); moveRowToUpQueue("============================================================"); moveRowToUpQueue(" "); step_ = RETURNING_ENTRY_; } break; case RETURNING_ENTRY_: { // if no room in up queue, won't be able to return data/status. // Come back later. if (qparent_.up->isFull()) return WORK_OK; Lng32 sqlcode, nskcode, retries, delay, type, intAQR; Lng32 eof = 0; eof = aqr->getNextAQREntry(sqlcode, nskcode, retries, delay, type, intAQR); if (eof) { step_ = DONE_; break; } // internal aqr entry, no need to display if (intAQR) break; char formattedStr[400]; str_sprintf(formattedStr, "%9d %13d %9d %9d %9d", sqlcode, nskcode, retries, delay, type); moveRowToUpQueue(formattedStr); } break; case HANDLE_ERROR_: { if (qparent_.up->isFull()) return WORK_OK; ExHandleErrors(qparent_, pentry_down, 0, getGlobals(), NULL, (ExeErrorCode)8931, NULL, NULL ); step_ = DONE_; } break; case DONE_: { if (qparent_.up->isFull()) return WORK_OK; // all ok. Return EOF. ex_queue_entry * up_entry = qparent_.up->getTailEntry(); up_entry->upState.parentIndex = pentry_down->downState.parentIndex; up_entry->upState.setMatchNo(0); up_entry->upState.status = ex_queue::Q_NO_DATA; // insert into parent qparent_.up->insert(); step_ = EMPTY_; qparent_.down->removeHead(); return WORK_OK; } break; } // switch } return 0; }