4I1Berkeley DB: DbInfo::set_re_source[P

DbInfo::set_re_source





#include <db_cxx.h>

#void DbInfo::set_re_source(char *);





Description



;Set the underlying source file for the Recno access method.GThe purpose of the re_source value is to provide fast access andFmodification to databases that are normally stored as flat text files.

KIf the re_source field is explicitly set, it specifies an underlyingLflat text database file that is read to initialize a transient record numberindex.HIn the case of variable length records, the records are separated by thebyte value re_delim.MFor example, standard UNIX byte stream files can be interpreted as a sequenceCof variable length records separated by <newline> characters.

CIn addition, when cached data would normally be written back to theZunderlying database file (e.g., the Db::close oriDb::sync methods are called), the in-memory copy of the database2will be written back to the re_source file.

IBy default, the backing source file is read lazily, i.e., records are not?read from the file until they are requested by the application.BIf multiple processes (not threads) are accessing a recno database6concurrently and either inserting or deleting records,Ethe backing source file must be read in its entirety before more thanDa single process accesses the database, and only that process shouldfspecify the backing source file as part of the Db::open call.

.See the DB_SNAPSHOT flag for more information.

IReading and writing the backing source file specified by re_sourceBcannot be transactionally protected because it involves filesystem?operations that are not part of the Db transaction methodology.EFor this reason, if a temporary database is used to hold the records,li.e., a NULL was specified as the file argument to Db::open,Git is possible to lose the contents of the re_source file, e.g.,+if the system crashes at the right instant.GIf a file is used to hold the database, i.e., a file name was specifiedaas the file argument to Db::open, normal database>recovery on that file can be used to prevent information loss,Calthough it is still possible that the contents of re_source#will be lost if the system crashes.

JThe re_source file must already exist (but may be zero-length) when<Db::open is called.

JFor all of the above reasons, the re_source field is generally usedfto specify databases that are read-only for Db applications,;and that are either generated on the fly by software tools,=or modified using a different mechanism, e.g., a text editor.



Class

4DbInfo



See Also

NDbInfo::set_bt_compare,LDbInfo::set_bt_maxkey,LDbInfo::set_bt_minkey,LDbInfo::set_bt_prefix,LDbInfo::set_cachesize,HDbInfo::set_compare,DDbInfo::set_flags,LDbInfo::set_h_ffactor,FDbInfo::set_h_hash,HDbInfo::set_h_nelem,FDbInfo::set_lorder,FDbInfo::set_malloc,JDbInfo::set_pagesize,JDbInfo::set_re_delim,FDbInfo::set_re_len,EDbInfo::set_re_padandDbInfo::set_re_source.
ÿÿ