75 static const char kDefaultDatabase[];
141 void Open(
const string& filename,
143 bool support_dirty_read =
false,
144 unsigned rec_len = 0);
147 void Open(
const string& filename,
150 bool support_dirty_read =
false,
151 unsigned rec_len = 0);
158 void Reopen(EOpenMode open_mode,
159 bool support_dirty_read =
false,
160 unsigned rec_len = 0);
168 unsigned int SafeTruncate();
170 void Rename(
const string& fname,
171 const string& old_name,
172 const string& new_name);
176 void Compact(ECompact compact_type = eCompactNoFree,
177 int target_fill_pct = 0);
182 typedef bool (*FContinueCompact)(void);
183 void CompactEx(FContinueCompact compact_callback,
184 ECompact compact_type = eCompactNoFree,
185 int target_fill_pct = 0);
188 void SetPageSize(
unsigned int page_size);
191 unsigned int GetPageSize();
194 void SetCacheSize(
unsigned int cache_size);
212 void SetCachePriority(ECachePriority priority);
214 const string& FileName()
const;
215 const string& Database()
const;
223 virtual void SetHash(
DB*);
229 bool IsAttached()
const;
252 unsigned CountRecs(
bool bFast =
false);
268 unsigned GetRecLen()
const;
271 void SetHashFillFactor(
unsigned h_ffactor);
274 void SetHashNelem(
unsigned h_nelem);
281 void SetBtreeMinKeysPerPage(
unsigned int keys_per_page);
282 unsigned int GetBtreeMinKeysPerPage();
301 bool support_dirty_read,
303 void x_Create(
const char* filename,
const char*
database);
311 void x_CreateDB(
unsigned rec_len);
328 unsigned int flags = 0)
const;
365 int x_FetchBufferDecompress(
DBT *
data,
void* usr_data);
369 virtual void x_SetByteSwapped(
bool bswp);
451 void Open(
const string& filename,
453 bool support_dirty_read =
false,
454 unsigned rec_len = 0);
458 void Open(
const string& filename,
461 bool support_dirty_read =
false,
462 unsigned rec_len = 0);
464 void Reopen(
EOpenMode open_mode,
bool support_dirty_read =
false);
484 EBDB_ErrCode Insert(EAfterWrite write_flag = eDiscardData);
490 unsigned Append(EAfterWrite write_flag = eDiscardData);
493 EBDB_ErrCode Delete(EIgnoreError on_error=eThrowOnError);
497 EBDB_ErrCode UpdateInsert(EAfterWrite write_flag = eDiscardData);
500 void BindKey (
const char* field_name,
502 size_t buf_size = 0);
504 void BindData(
const char* field_name,
510 void DuplicateStructure(
const CBDB_File& dbf);
526 void SetFieldCompareLimit(
unsigned int n_fields);
533 static void DestroyDBT_Clone(
DBT* dbt);
536 void SetLegacyStringsCheck(
bool value);
560 void SetFieldOwnership(
bool own_fields);
570 void Verify(
const char* filename,
const char*
database, FILE* backup);
582 virtual void SetCmp(
DB*);
591 EReallocMode allow_realloc);
604 unsigned int bdb_flag,
611 EAfterWrite write_flag);
616 DBC*
dbc,
unsigned int bdb_flag,
617 EAfterWrite write_flag);
624 void CheckNullDataConstraint()
const;
638 void DisableDataPacking();
643 virtual void x_SetByteSwapped(
bool bswp);
658 void x_CheckConstructBuffers();
660 void x_ConstructKeyBuf();
661 void x_ConstructDataBuf();
693 virtual void SetCmp(
DB* db);
714 return key ? (-fidx) : (fidx);
725 const string& filename,
EOpenMode open_mode,
726 bool support_dirty_read,
729 Open(filename,
kEmptyStr, open_mode, support_dirty_read, rec_len);
775 const string& filename,
EOpenMode open_mode,
776 bool support_dirty_read,
unsigned rec_len)
778 Open(filename,
"", open_mode, support_dirty_read, rec_len);
792 m_KeyBuf->SetFieldCompareLimit(n_fields);
BDB Data Field Buffer manager class.
BDB environment object a collection including support for some or all of caching, locking,...
Base class for constructing BDB fields.
Berkeley DB file cursor class.
Berkeley DB file class optimized to work with tables having int as the primary key.
Multirow buffer for reading many rows in one call.
Raw file class wraps up basic Berkeley DB operations.
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
Interface for transactional objects.
std::ofstream out("events_result.xml")
main entry point for tests
ENullable
Whether a value is nullable.
@ eNullable
Value can be null.
@ eTakeOwnership
An object can take ownership of another.
string m_Database
db name in file (optional)
EDuplicateKeys GetDupKeysMode() const
Return the key duplicate mode value.
CBDB_MultiRowBuffer(const CBDB_MultiRowBuffer &)
size_t GetLastDataLen() const
Get BLOB length from last cursor read.
CBDB_Transaction * m_Trans
CBDB_MultiRowBuffer & operator=(const CBDB_MultiRowBuffer &)
size_t m_BufSize
buffer size
void * m_LastData
Last data pointer returned by DB_MULTIPLE_KEY_NEXT.
AutoPtr< ICompression > m_Compressor
Record compressor.
bool IsOpen() const
Return TRUE if the file is open.
virtual void SetCmp(DB *)=0
Set comparison function.
ECompact
BerkeleyDB compaction methods and flags.
DBT * m_Data_DBT
Temp DBT for multiple fetch.
void DisableHashOverride()
Disable hash method override (Berkeley DB will use it's own default hashing method)
EOpenMode
BDB file open mode.
void * m_Buf
Multiple row buffer.
bool IsByteSwapped() const
Return TRUE if the if the underlying database files were created on an architecture of the different ...
void Open(const string &filename, EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
Open file with specified access mode.
void DisableCmpOverride()
Disable BTREE comparison override.
const string & Database() const
CBDB_Transaction * GetBDBTransaction()
Get current transaction.
void DisableDataBufProcessing()
Function disables processing of m_DBT_data.
CBDB_File::TUnifiedFieldIndex BDB_GetUFieldIdx(int fidx, bool key)
Make field index in CBDB_File format.
bool IsOwnFields() const
Return fields ownership flag.
CBDB_RawFile(const CBDB_RawFile &)
forbidden
bool m_CmpOverride
TRUE - NCBI BDB sets its own cmp.
unique_ptr< CBDB_BufferManager > m_DataBuf
bool m_RevSplitOff
TRUE if reverse splitting is off.
EDBType
Berkeley DB database type.
EDuplicateKeys m_DuplicateKeys
string m_FileName
filename
void SetFieldCompareLimit(unsigned int n_fields)
Sets maximum number of key fields participating in comparison Should be less than total number of key...
CBDB_Env * GetEnv()
Get pointer on file environment Return NULL if no environment has been set.
const string & GetFileName() const
Return file name.
void * m_LastKey
Last key pointer returned by DB_MULTIPLE_KEY_NEXT.
int TUnifiedFieldIndex
CBDB_File keeps data in two buffers (key buffer and data buffer).
CBDB_BufferManager * GetKeyBuffer()
Get Buffer manager for key section of the file.
EDuplicateKeys
Control key duplicates in Btree.
void DisableNull()
Disable NULL/not NULL in data fields (Performance tweak, call before BindData)
EOpenMode GetOpenMode() const
Return the file open mode.
CSimpleBuffer TBuffer
typedef for raw buffer operations
static int x_CompareShim(DB *db, const DBT *dbt1, const DBT *dbt2, size_t *locp)
bool m_ByteSwapped
TRUE if file created on a diff.arch.
EReallocMode
BLOB read mode, controld data buffer reallocation when there is not enough space in buffer.
const CBDB_BufferManager * GetKeyBuffer() const
Get Buffer manager for key section of the file.
void EnablePrefixCompression()
Turn ON prefix compression.
ECachePriority
Set the priority for this database's pages in the buffer cache This is generally a temporary adviseme...
void Open(const string &filename, EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
Open file with specified access mode.
const void * GetLastDataPtr() const
Get data buffer pointer from last cursor read.
static const int kOpenFileMask
const string & FileName() const
EBDB_ErrCode
BDB Return codes.
const CBDB_BufferManager * GetDataBuffer() const
Get Buffer manager for data section of the file.
void * m_BufPtr
current buffer position
CBDB_BufferManager * GetDataBuffer()
Get Buffer manager for data section of the file.
void CheckNullDataConstraint() const
Check if all NOT NULL fields are assigned.
bool m_PrefixCompress
TRUE if prefix compression ON.
unique_ptr< CBDB_BufferManager > m_KeyBuf
bool DuplicatesAllowed() const
Return TRUE if file can contain duplicate keys.
unsigned GetRecLen() const
Get record length Works for fixed length record DBs only (Queue)
CBDB_File(const CBDB_File &)
forbidden
bool m_DB_Attached
TRUE if m_DB doesn't belong here.
EBDB_ErrCode Fetch()
Fetches the record corresponding to the current key value.
@ eKeepData
Keep the inserted data for a while.
@ eCreate
implies 'eReadWrite' too
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
CTime Truncate(const CTime &t)
virtual void SetTransaction(ITransaction *trans)=0
Establish transaction association.
virtual ITransaction * GetTransaction()=0
Get current transaction.
virtual void RemoveTransaction(ITransaction *trans)=0
Remove transaction association (must be established by SetTransaction.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
use only n Cassandra database for the lookups</td > n</tr > n< tr > n< td > yes</td > n< td > do not use tables BIOSEQ_INFO and BLOB_PROP in the Cassandra database
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
static void x_Close(SHttpConnector *uuu)
static SERV_ITER x_Open(const char *service, int ismask, TSERV_Type types, unsigned int preferred_host, unsigned short preferred_port, double preference, const SConnNetInfo *net_info, SSERV_InfoCPtr skip[], size_t n_skip, int external, const char *arg, const char *val, SSERV_Info **info, HOST_INFO *host_info)
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.