<!DOCTYPE File PUBLIC "-//Liam Quin//DTD C API Documentation v1.1//EN" "doc.dtd"><File>
<Entry dir="liblqtext">
<Function File="../../src/liblqtext/lastblk.c">
<Name>LQT_SetLastBlockInChain</Name>
<Class>Database/Update, Database/Files
<Purpose>
<P>LQT_SetLastBlockInChain maintains the chainend file in the
database directory; this contains the block number of the last
block in the chain used to store data for a given WID.  This
allows lqaddfile to update an entry efficiently, as otherwise it
has to read the entire chain from the start to determine the
last block before it can start appending to it.
Failing to call this function after changing the last block number
for a given WID will result in a corrupt database.</P>
<P>The given Offsetp is a pointer to a long, although the value
is not changed; this is simply for consistency with other routines,
and may change in the future.  The FirstUnusedBytepp is currently
used only for debugging; the value is recomputed from the data
when it is used.
<Errors>
Fatal error if the cache file can't be created, if it isn't
already open.
<SeeAlso>
LQTp_FlushLastBlockCache, LQT_LastBlockInChain
</Function>
<Decl>
API void
LQT_SetLastBlockInChain(db, WID, Offsetp, FirstUnusedBytep, theBlock)
    t_LQTEXT_Database *db;
    t_WID WID;
    unsigned long *Offsetp; /* In: last offset */
    unsigned char *FirstUnusedBytep;
    unsigned char *theBlock;
</Decl>
</Entry>
