Commit an EDO to the cache. If the supplied object Id is 0, the EDO is a new object so the commit is an INSERT - in which case the object will be placed at the end, and the id issued in respect of it, will be the highest thusfar issues. If the supplied object id is non-zero, the commit is an UPDATE and it must be of an object that already exists and has not been deleted. In an UPDATE, the supplied EDO replaces the existing EDO. The supplied EDO may be shorter, longer, or the same size as the existing EDO. If the same size, the existing EDO is overwritten, otherwise the cache block is recreated. All data up to the existing EDO is copied to a new block, the supplied EDO is then added to the new block, then all data after the existing EDO is copied over - then the new block replaces the old.

Return TypeFunction nameArguments
hzEcodehdbObjRepos::CommitEDO(hzChain&,uint32_t,bool,)

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

Function Logic:

0:START 1:unknown 2:items 3:unknown 4:items 5:unknown 6:items 7:unknown 8:Return hzerr(E_CORRUPT,RAM Primacy Cache NOT in Operation) 9:unknown 10:m_nSeqId 11:items items items 12:Return E_OK

Function body:

hzEcode hdbObjRepos::CommitEDO (hzChain& edo)uint32_t objId, bool bLoad, 
{
   //  Commit an EDO to the cache.
   //  
   //  If the supplied object Id is 0, the EDO is a new object so the commit is an INSERT - in which case the object will be placed at the end, and the id issued in respect of it,
   //  will be the highest thusfar issues. If the supplied object id is non-zero, the commit is an UPDATE and it must be of an object that already exists and has not been deleted.
   //  
   //  In an UPDATE, the supplied EDO replaces the existing EDO. The supplied EDO may be shorter, longer, or the same size as the existing EDO. If the same size, the existing EDO
   //  is overwritten, otherwise the cache block is recreated. All data up to the existing EDO is copied to a new block, the supplied EDO is then added to the new block, then all
   //  data after the existing EDO is copied over - then the new block replaces the old.
   //  
   //  Arguments: 1) edo  EDO to commit (supplied as hzChain)
   //     2) objId The object id
   //  
   //  Returns: E_CORRUPPT If the supplied object id is non-zero but no cache block could be identified.
   //     E_NOTFOUND If the supplied object id addresses a deleted object
   //     E_OK  Operation successful
   _hzfunc("hdbObjRepos::CommitEDO") ;
   hzEdo   theEdo ;    //  The EDO instance
   //  Validate
   if (!this)      hzexit(E_CORRUPT, "No repository instance") ;
   if (!m_pClass)  hzexit(E_NOINIT, "Cache not initialized") ;
   if (!objId)
       hzexit(E_ARGUMENT, "Invalid object ID") ;
   if (!(m_eMode & HDB_REPOS_CACHE))
       return hzerr(E_CORRUPT, "RAM Primacy Cache NOT in Operation") ;
   if (objId > m_nSeqId)
       m_nSeqId = objId ;
   /*
   **  Diags
   **   hzChain err ;
   **   chIter ei ;
   **   err << "EDO is [ " ;
   **   for (ei = edo ; !ei.eof() ; ei++)
   **   {
   **    err.Printf("%02x ", (uchar) *ei) ;
   **   }
   **   err << "]\n" ;
   **   threadLog(err) ;
   **   threadLog("Commiting EDO objId %d\n", objId) ;
   **      */
   theEdo.SetValue(edo) ;
   m_Cache.Insert(objId, theEdo) ;
   memset(&theEdo, 0,sizeof(hzEdo)) ;
   return E_OK ;
}