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 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 nsMsgDBThreadEnumerator::PrefetchNext(){	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);			// we've got empty thread; don't tell caller about it.			if (numChildren == 0)				continue;		}		if (mFilter && mFilter(mResultThread) != NS_OK)			continue;		else			break;    }    if (mResultThread) 	{		mNextPrefetched = PR_TRUE;        return NS_OK;    }    return NS_ERROR_FAILURE;}