nsresult rv = NS_OK; nsIMdbRow* hdrRow; mdb_pos rowPos; PRUint32 flags;  if (!mRowCursor) { rv = GetRowCursor(); if (NS_FAILED(rv)) return rv; }  do { NS_IF_RELEASE(mResultHdr); mResultHdr = nsnull; rv = mRowCursor->NextRow(mDB->GetEnv(), &hdrRow, &rowPos); if (!hdrRow) { mDone = PR_TRUE; return NS_ERROR_FAILURE;
nsresult rv; nsIMdbTable *table = nsnull;  if (!mTableCursor) { rv = GetTableCursor(); if (NS_FAILED(rv)) return rv; } while (PR_TRUE) { NS_IF_RELEASE(mResultThread); mResultThread = nsnull; rv = mTableCursor->NextTable(mDB->GetEnv(), &table); if (!table) { mDone = PR_TRUE; return NS_ERROR_FAILURE; } if (NS_FAILED(rv)) { mDone = PR_TRUE; return rv; }  if (NS_FAILED(rv)) return rv;  mResultThread = new nsMsgThread(mDB, table); if(mResultThread) { PRUint32 numChildren = 0; NS_ADDREF(mResultThread); mResultThread->GetNumChildren(&numChildren);  if (numChildren == 0) continue; } if (mFilter && mFilter(mResultThread) != NS_OK) continue; else break;
nsresult nsMsgDBEnumerator::PrefetchNext(){  nsresult rv = NS_OK;  nsIMdbRow* hdrRow;  mdb_pos rowPos;  PRUint32 flags;    if (!mRowCursor)  {    rv = GetRowCursor();    if (NS_FAILED(rv))      return rv;  }    do {    NS_IF_RELEASE(mResultHdr);    mResultHdr = nsnull;    rv = mRowCursor->NextRow(mDB->GetEnv(), &hdrRow, &rowPos);    if (!hdrRow) {      mDone = PR_TRUE;      return NS_ERROR_FAILURE;    }    if (NS_FAILED(rv)) {      mDone = PR_TRUE;      return rv;    }    //Get key from row    mdbOid outOid;    nsMsgKey key=0;    if (hdrRow->GetOid(mDB->GetEnv(), &outOid) == NS_OK)      key = outOid.mOid_Id;        rv = mDB->GetHdrFromUseCache(key, &mResultHdr);    if (NS_SUCCEEDED(rv) && mResultHdr)      hdrRow->Release();    else      rv = mDB->CreateMsgHdr(hdrRow, key, &mResultHdr);    if (NS_FAILED(rv))      return rv;        if (mResultHdr)      mResultHdr->GetFlags(&flags);    else      flags = 0;  }   while (mFilter && mFilter(mResultHdr, mClosure) != NS_OK && !(flags & MSG_FLAG_EXPUNGED));    if (mResultHdr)   {    mNextPrefetched = PR_TRUE;    return NS_OK;  }  return NS_ERROR_FAILURE;}