Return TypeFunction nameArguments
hzEcodehdbIndexEnum::Dump(const hzString&,bool,)

Declared in file: hzDatabase.h
Defined in file : hdbIndex.cpp

Function Logic:

0:START 1:!Filename 2:Return hzerr(E_ARGUMENT,No filename supplied) 3:ofstream::open ofstream::fail 4:os.fail() 5:Return hzerr(E_OPENFAIL,Could not open index dump file (%s),*Filename) 6:items ev 7:ev 8:hzMapS::GetObj pI 9:!pI 10:sprintf items 11:hdbIdset::Count nRecs 12:!nRecs 13:sprintf items 14:sprintf items 15:!bFull 16:proc 17:nStart 18:hdbIdset::Fetch nFetched 19:!nFetched 20:sprintf items ofstream::fail 21:os.fail() 22:close 23:Return E_WRITEFAIL 24:items close 25:Return E_OK

Function body:

hzEcode hdbIndexEnum::Dump (const hzString& Filename, bool bFull)
{
   _hzfunc("hdbIndexEnum::Dump") ;
   hzVect<uint32_t>    Results ;
   ofstream    os ;
   hzChain     Z ;
   hdbIdset    proc ;
   hdbIdset*   pI ;
   uint32_t    ev ;
   uint32_t    nRecs ;
   uint32_t    nFetched = 0;
   uint32_t    nStart ;
   char        cvLine  [120];
   if (!Filename)
       return hzerr(E_ARGUMENT, "No filename supplied") ;
   os.open(*Filename) ;
   if (os.fail())
       return hzerr(E_OPENFAIL, "Could not open index dump file (%s)", *Filename) ;
   os << "Index Dump\n" ;
   for (ev = 0; ev < m_Maps.Count() ; ev++)
   {
       pI = m_Maps.GetObj(ev) ;
       if (!pI)
       {
           sprintf(cvLine, "Enum-Val %d (null list)\n", ev) ;
           os << cvLine ;
           continue ;
       }
       nRecs = pI->Count() ;
       if (!nRecs)
       {
           sprintf(cvLine, "Enum-Val %d (empty list)\n", ev) ;
           os << cvLine ;
           continue ;
       }
       sprintf(cvLine, "Enum-Val %d (%d objects)\n", ev, nRecs) ;
       os << cvLine ;
       if (!bFull)
           continue ;
       proc = *pI ;
       for (nStart = 0; nStart < nRecs ; nStart += 10)
       {
           nFetched = proc.Fetch(Results, nStart, 10);
           if (!nFetched)
               break ;
           sprintf(cvLine, "  %10d %10d %10d %10d %10d %10d %10d %10d %10d %10d\n",
               Results[0],Results[1],Results[2],Results[3],Results[4],
               Results[5],Results[6],Results[7],Results[8],Results[9]);
           os << cvLine ;
       }
       if (os.fail())
       {
           os.close() ;
           hzerr(E_WRITEFAIL, "Could not write to index dump file (%s)", *Filename) ;
           return E_WRITEFAIL ;
       }
   }
   os << "Index Dump End\n" ;
   os.close() ;
   return E_OK ;
}