Output list of keys and thier segment numbers together with the segment contents (Ids relative to the segment start)
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdbIndexEnum::Dump | (hzString&,bool,) |
Declared in file: hzDatabase.h
Defined in file : hdbIndex.cpp
Function Logic:
Function body:
hzEcode hdbIndexEnum::Dump (hzString& Filename)bool bFull,
{
// Output list of keys and thier segment numbers together with the segment contents (Ids relative to the segment start)
//
// Arguments: 1) Full path of file to dump to
// 2) Do a full dump (true) or just segments (false)
//
// Returns: E_ARGUMENT If the filename is not supplied
// E_OPENFAIL If the supplied filename cannot be opened
// E_WRITEFAIL If there was a write error
// E_OK If the index was dumped to file
_hzfunc("hdbIndexEnum::Dump") ;
hzVect<uint32_t> Results ; // Results of fetch
ofstream os ; // Output stream
hzChain Z ; // Used to build list of ids
hzIntset proc ; // Processing bitmap
hzIntset* pI ; // The Id set assoc with key
uint32_t ev ; // Enum value
uint32_t nRecs ; // Total number of records fetched
uint32_t nFetched = 0; // Number of record fetched in call to Fetch()
uint32_t nStart ; // Starter for Fetch
char cvLine [120]; // For output
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 ;
// Extract ids from the binaries
proc = *pI ;
for (nStart = 0; nStart < nRecs ; nStart += 10)
{
// for (nIndex = 0 ; nIndex < 10 ; nIndex++)
// Results[nIndex] = -1 ;
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 ;
}