NCBI C++ ToolKit
|
Search Toolkit Book for CLDS2_Database
#include <objtools/lds2/lds2_db.hpp>
Classes | |
struct | SLDS2_DbConnection |
Public Types | |
enum | EAccessMode { eRead , eWrite , eMemory } |
Database access mode flags. More... | |
enum | EAnnotChoice { fAnnot_Internal = 1 , fAnnot_External = 2 , fAnnot_All = fAnnot_Internal | fAnnot_External } |
Annotation type flags. More... | |
typedef set< string > | TStringSet |
typedef set< CSeq_id_Handle > | TSeqIdSet |
typedef set< Int8 > | TLdsIdSet |
List of ids (blob_id, bioseq_id, lds_id etc.) More... | |
typedef vector< CSeq_id_Handle > | TSeqIds |
List of seq-ids. More... | |
typedef vector< SLDS2_Blob > | TBlobSet |
A set of ids (file_id, blob_id etc.). More... | |
typedef int | TAnnotChoice |
typedef vector< AutoPtr< SLDS2_Annot > > | TLDS2Annots |
Public Types inherited from CObject | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
Public Member Functions | |
CLDS2_Database (const string &db_file, EAccessMode mode=eWrite) | |
~CLDS2_Database (void) | |
void | Create (void) |
Create the database. More... | |
void | Open (EAccessMode mode=eWrite) |
Open LDS2 database. If the database does not exist, throws exception. More... | |
const string & | GetDbFile (void) const |
Get database file name. More... | |
int | GetSQLiteFlags (void) const |
Get SQLite flags, see CSQLITE_Connection::TOperationFlags. More... | |
void | SetSQLiteFlags (int flags) |
Set SQLite flags. This funtion resets the db connection. More... | |
EAccessMode | GetAccessMode (void) const |
Get current access mode. More... | |
void | SetAccessMode (EAccessMode mode) |
Set new access mode, re-open the database. More... | |
void | GetFileNames (TStringSet &files) const |
Get all known file names. More... | |
SLDS2_File | GetFileInfo (const string &file_name) const |
Get complete file info. More... | |
void | AddFile (SLDS2_File &info) |
Add new file record. On success file_info.id is not zero. More... | |
void | UpdateFile (SLDS2_File &info) |
Update info for the known file. The 'id' of the info will change. More... | |
void | DeleteFile (const string &file_name) |
Delete file and all related entries from the database. More... | |
void | DeleteFile (Int8 file_id) |
Int8 | AddBlob (Int8 file_id, SLDS2_Blob::EBlobType blob_type, Int8 file_pos) |
Add blob, return the new blob id. More... | |
Int8 | AddBioseq (Int8 blob_id, const TSeqIdSet &ids) |
Add bioseq, return the new bioseq id. More... | |
Int8 | AddAnnot (SLDS2_Annot &annot) |
Add annotation, return the new annot id. More... | |
Int8 | GetBioseqId (const CSeq_id_Handle &idh) const |
Check if the db contains a bioseq with the given id. More... | |
void | GetSynonyms (const CSeq_id_Handle &idh, TLdsIdSet &ids) |
Get all lds-id synonyms for the seq-id (including lds-id for the seq-id itself). More... | |
void | GetSynonyms (const CSeq_id_Handle &idh, TSeqIds &ids) |
Get all synonyms for the seq-id (including the original seq-id). More... | |
SLDS2_Blob | GetBlobInfo (const CSeq_id_Handle &idh) |
Find blob containing the requested bioseq. More... | |
SLDS2_Blob | GetBlobInfo (Int8 blob_id) |
Get blob info by blob id. More... | |
SLDS2_File | GetFileInfo (Int8 file_id) |
Get file info. More... | |
void | GetBioseqBlobs (const CSeq_id_Handle &idh, TBlobSet &blobs) |
Get all blobs, containing bioseqs with the seq-id. More... | |
void | GetAnnotBlobs (const CSeq_id_Handle &idh, TAnnotChoice choice, TBlobSet &blobs) |
Get all blobs, containing annotations for the seq-id. More... | |
Int8 | GetAnnotCountForBlob (Int8 blob_id) |
Get number of annotations grouped into a single blob. More... | |
void | GetAnnots (Int8 blob_id, TLDS2Annots &infos) |
Get details about all annotations from a blob. More... | |
void | AddChunk (const SLDS2_File &file_info, const SLDS2_Chunk &chunk_info) |
Store the chunk info in the database. More... | |
bool | FindChunk (const SLDS2_File &file_info, SLDS2_Chunk &chunk_info, Int8 stream_pos) |
Load chunk containing the required stream position. More... | |
CRef< CSeq_id > | GetSeq_idForLdsSeqId (int lds_id) |
Get seq-id for the given lds-id. More... | |
void | PrepareUpdate (void) |
Prepare to update the DB. More... | |
void | BeginUpdate (void) |
Start update transaction. More... | |
void | EndUpdate (void) |
End update transaction, commit the changes. More... | |
void | CancelUpdate (void) |
Cancel the update, rollback the changes. More... | |
void | BeginRead (void) |
Start reading transaction, lock the db. More... | |
void | EndRead (void) |
End reading transaction, release the lock. More... | |
void | Analyze (void) |
Analyze the DB. More... | |
void | Dump (const string &table, CNcbiOstream &out) |
Dump the selected table (use empty string to dump table names or * to dump all tables. More... | |
Public Member Functions inherited from CObject | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
Public Member Functions inherited from CDebugDumpable | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Private Member Functions | |
CLDS2_Database (const CLDS2_Database &) | |
CLDS2_Database & | operator= (const CLDS2_Database &) |
void | x_ExecuteSqls (const char *sqls[], size_t len) |
CSQLITE_Statement & | x_InitGetBioseqsSql (const CSeq_id_Handle &idh) const |
Int8 | x_GetLdsSeqId (const CSeq_id_Handle &id, EIdType id_type) |
CRef< CSeq_id > | x_BlobToSeq_id (CSQLITE_Statement &st, int size_idx, int data_idx) const |
SLDS2_DbConnection & | x_GetDbConnection (void) const |
CSQLITE_Connection & | x_GetConn (void) const |
void | x_ResetDbConnection (void) |
CSQLITE_Statement & | x_GetStatement (EStatement st) const |
Private Attributes | |
string | m_DbFile |
int | m_DbFlags |
CFastMutex | m_DbInitMutex |
CRef< TDbConnectionsTls > | m_DbConn |
EAccessMode | m_Mode |
Additional Inherited Members | |
Static Public Member Functions inherited from CObject | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
Static Public Member Functions inherited from CDebugDumpable | |
static void | EnableDebugDump (bool on) |
Static Public Attributes inherited from CObject | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
Protected Member Functions inherited from CObject | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
Definition at line 240 of file lds2_db.hpp.
typedef int CLDS2_Database::TAnnotChoice |
Definition at line 344 of file lds2_db.hpp.
typedef vector<SLDS2_Blob> CLDS2_Database::TBlobSet |
A set of ids (file_id, blob_id etc.).
Definition at line 332 of file lds2_db.hpp.
|
private |
Definition at line 462 of file lds2_db.hpp.
typedef vector< AutoPtr<SLDS2_Annot> > CLDS2_Database::TLDS2Annots |
Definition at line 354 of file lds2_db.hpp.
typedef set<Int8> CLDS2_Database::TLdsIdSet |
List of ids (blob_id, bioseq_id, lds_id etc.)
Definition at line 308 of file lds2_db.hpp.
typedef vector<CSeq_id_Handle> CLDS2_Database::TSeqIds |
List of seq-ids.
Definition at line 310 of file lds2_db.hpp.
typedef set<CSeq_id_Handle> CLDS2_Database::TSeqIdSet |
Definition at line 295 of file lds2_db.hpp.
|
private |
Definition at line 453 of file lds2_db.hpp.
typedef set<string> CLDS2_Database::TStringSet |
Definition at line 276 of file lds2_db.hpp.
Database access mode flags.
Enumerator | |
---|---|
eRead | Read-only access. |
eWrite | Read/write access. |
eMemory | Copy db to memory and open read-only. |
Definition at line 244 of file lds2_db.hpp.
Annotation type flags.
Enumerator | |
---|---|
fAnnot_Internal | Annots from the blob with the bioseq. |
fAnnot_External | Annots from blobs not containing the bioseq. |
fAnnot_All |
Definition at line 338 of file lds2_db.hpp.
|
private |
Enumerator | |
---|---|
eIdOriginal | |
eIdMatch |
Definition at line 407 of file lds2_db.hpp.
|
private |
Definition at line 420 of file lds2_db.hpp.
CLDS2_Database::CLDS2_Database | ( | const string & | db_file, |
EAccessMode | mode = eWrite |
||
) |
Definition at line 59 of file lds2_db.cpp.
CLDS2_Database::~CLDS2_Database | ( | void | ) |
Definition at line 67 of file lds2_db.cpp.
|
private |
Int8 CLDS2_Database::AddAnnot | ( | SLDS2_Annot & | annot | ) |
Add annotation, return the new annot id.
Definition at line 622 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), CSQLITE_Statement::BindNull(), SLDS2_Annot::blob_id, eIdOriginal, eSt_AddAnnotIds, eSt_AddAnnotToBlob, CSQLITE_Statement::Execute(), CSQLITE_Statement::GetLastInsertedRowid(), SLDS2_Annot::id, SLDS2_Annot::is_named, SLDS2_Annot::name, NON_CONST_ITERATE, SLDS2_Annot::ref_ids, CSQLITE_Statement::Reset(), SLDS2_Annot::type, x_GetLdsSeqId(), and x_GetStatement().
Referenced by CLDS2_ObjectParser::EndBlob().
Add bioseq, return the new bioseq id.
Definition at line 588 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eIdMatch, eIdOriginal, eSt_AddBioseqIds, eSt_AddBioseqToBlob, CSQLITE_Statement::Execute(), CSQLITE_Statement::GetLastInsertedRowid(), ITERATE, match(), CSQLITE_Statement::Reset(), x_GetLdsSeqId(), and x_GetStatement().
Referenced by CLDS2_ObjectParser::EndBlob(), and CLDS2_Manager::x_ParseFile().
Int8 CLDS2_Database::AddBlob | ( | Int8 | file_id, |
SLDS2_Blob::EBlobType | blob_type, | ||
Int8 | file_pos | ||
) |
Add blob, return the new blob id.
Definition at line 571 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_AddBlob, CSQLITE_Statement::Execute(), CSQLITE_Statement::GetLastInsertedRowid(), CSQLITE_Statement::Reset(), and x_GetStatement().
Referenced by CLDS2_ObjectParser::EndBlob(), and CLDS2_Manager::x_ParseFile().
void CLDS2_Database::AddChunk | ( | const SLDS2_File & | file_info, |
const SLDS2_Chunk & | chunk_info | ||
) |
Store the chunk info in the database.
Definition at line 939 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), SLDS2_Chunk::data, SLDS2_Chunk::data_size, eSt_AddChunk, CSQLITE_Statement::Execute(), SLDS2_File::id, SLDS2_Chunk::raw_pos, CSQLITE_Statement::Reset(), SLDS2_Chunk::stream_pos, and x_GetStatement().
Referenced by CGZipChunkHandler::OnChunk().
void CLDS2_Database::AddFile | ( | SLDS2_File & | info | ) |
Add new file record. On success file_info.id is not zero.
Definition at line 482 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_AddFile, CSQLITE_Statement::Execute(), CSQLITE_Statement::GetLastInsertedRowid(), Info(), info, LOG_POST_X, CSQLITE_Statement::Reset(), and x_GetStatement().
Referenced by CLDS2_Manager::UpdateData(), and UpdateFile().
void CLDS2_Database::Analyze | ( | void | ) |
Analyze the DB.
Definition at line 1029 of file lds2_db.cpp.
References conn, and x_GetConn().
Referenced by EndUpdate().
void CLDS2_Database::BeginRead | ( | void | ) |
Start reading transaction, lock the db.
Definition at line 1039 of file lds2_db.cpp.
References eWrite, CSQLITE_Connection::ExecuteSql(), m_Mode, and x_GetConn().
Referenced by CLDS2_DataLoader::CLDS2_DataLoader().
void CLDS2_Database::BeginUpdate | ( | void | ) |
Start update transaction.
Definition at line 1010 of file lds2_db.cpp.
References conn, kLDS2_DropDBIdx, x_ExecuteSqls(), and x_GetConn().
Referenced by CLDS2_Manager::UpdateData().
void CLDS2_Database::CancelUpdate | ( | void | ) |
Cancel the update, rollback the changes.
void CLDS2_Database::Create | ( | void | ) |
Create the database.
If the LDS2 database already exists all data will be cleaned up. Access mode is automatically set to read/write. NOTE: The function may fail if the db has been accessed from other threads and some of the threads are still alive.
Definition at line 428 of file lds2_db.cpp.
References eWrite, CFile::Exists(), Info(), kLDS2_CreateDB, LOG_POST_X, m_DbFile, CDirEntry::Remove(), SetAccessMode(), x_ExecuteSqls(), and x_ResetDbConnection().
Referenced by CLDS2_Manager::ResetData(), and CLDS2_Manager::UpdateData().
Delete file and all related entries from the database.
Definition at line 506 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_DeleteFileByName, CSQLITE_Statement::Execute(), file_name, Info(), LOG_POST_X, CSQLITE_Statement::Reset(), and x_GetStatement().
Referenced by CLDS2_Manager::UpdateData(), UpdateFile(), and CLDS2_Manager::x_ParseFile().
void CLDS2_Database::DeleteFile | ( | Int8 | file_id | ) |
Definition at line 516 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_DeleteFileById, CSQLITE_Statement::Execute(), Info(), LOG_POST_X, CSQLITE_Statement::Reset(), and x_GetStatement().
void CLDS2_Database::Dump | ( | const string & | table, |
CNcbiOstream & | out | ||
) |
Dump the selected table (use empty string to dump table names or * to dump all tables.
Definition at line 1060 of file lds2_db.cpp.
References CSQLITE_Statement::GetColumnName(), CSQLITE_Statement::GetColumnsCount(), CSQLITE_Statement::GetString(), i, ITERATE, kLDS2_DumpTable, kLDS2_ListTables, out(), NStr::PrintableString(), CSQLITE_Statement::Step(), table, tables(), and x_GetConn().
Referenced by CLDS2IndexerApplication::Run().
void CLDS2_Database::EndRead | ( | void | ) |
End reading transaction, release the lock.
Definition at line 1047 of file lds2_db.cpp.
References eWrite, CSQLITE_Connection::ExecuteSql(), m_Mode, and x_GetConn().
Referenced by CLDS2_DataLoader::~CLDS2_DataLoader().
void CLDS2_Database::EndUpdate | ( | void | ) |
End update transaction, commit the changes.
Definition at line 1019 of file lds2_db.cpp.
References Analyze(), conn, kLDS2_CreateDBIdx, x_ExecuteSqls(), and x_GetConn().
Referenced by CLDS2_Manager::UpdateData().
bool CLDS2_Database::FindChunk | ( | const SLDS2_File & | file_info, |
SLDS2_Chunk & | chunk_info, | ||
Int8 | stream_pos | ||
) |
Load chunk containing the required stream position.
Return true on success.
Definition at line 953 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), SLDS2_Chunk::data, SLDS2_Chunk::data_size, SLDS2_Chunk::DeleteData(), eSt_FindChunk, CSQLITE_Statement::GetBlob(), CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), SLDS2_File::id, SLDS2_Chunk::InitData(), SLDS2_Chunk::raw_pos, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), SLDS2_Chunk::stream_pos, and x_GetStatement().
Referenced by CLDS2_UrlHandler_GZipFile::OpenStream().
|
inline |
void CLDS2_Database::GetAnnotBlobs | ( | const CSeq_id_Handle & | idh, |
TAnnotChoice | choice, | ||
TBlobSet & | blobs | ||
) |
Get all blobs, containing annotations for the seq-id.
Definition at line 836 of file lds2_db.cpp.
References CSeq_id_Handle::AsString(), CSQLITE_Statement::Bind(), eSt_GetAnnotBlobsAllByIntId, eSt_GetAnnotBlobsAllByTxtId, eSt_GetAnnotBlobsByIntId, eSt_GetAnnotBlobsByTxtId, fAnnot_All, fAnnot_External, CSeq_id_Handle::GetGi(), CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), GI_TO, info, CSeq_id_Handle::IsGi(), NULL, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_DataLoader::GetRecords().
Get number of annotations grouped into a single blob.
Definition at line 868 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetAnnotCountForBlob, CSQLITE_Statement::GetInt8(), CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_DataLoader::GetChunk().
void CLDS2_Database::GetAnnots | ( | Int8 | blob_id, |
TLDS2Annots & | infos | ||
) |
Get details about all annotations from a blob.
Definition at line 884 of file lds2_db.cpp.
References _ASSERT, CSQLITE_Statement::Bind(), map_checker< Container >::end(), eSt_GetAnnotInfosForBlob, SLDS2_AnnotIdInfo::external, map_checker< Container >::find(), CSeq_id_Handle::GetHandle(), CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), CSQLITE_Statement::GetString(), SLDS2_AnnotIdInfo::range, CSQLITE_Statement::Reset(), COpenRange< Position >::SetOpen(), CSQLITE_Statement::Step(), x_BlobToSeq_id(), and x_GetStatement().
Referenced by CLDS2_DataLoader::x_LoadTSE().
void CLDS2_Database::GetBioseqBlobs | ( | const CSeq_id_Handle & | idh, |
TBlobSet & | blobs | ||
) |
Get all blobs, containing bioseqs with the seq-id.
Definition at line 820 of file lds2_db.cpp.
References CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), info, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_InitGetBioseqsSql().
Referenced by CLDS2_DataLoader::GetRecords().
Int8 CLDS2_Database::GetBioseqId | ( | const CSeq_id_Handle & | idh | ) | const |
Check if the db contains a bioseq with the given id.
Return -1 on conflict.
Definition at line 656 of file lds2_db.cpp.
References CSeq_id_Handle::AsString(), CSQLITE_Statement::Bind(), eSt_GetBioseqIdForIntId, eSt_GetBioseqIdForTxtId, CSeq_id_Handle::GetGi(), CSQLITE_Statement::GetInt8(), GI_TO, CSeq_id_Handle::IsGi(), NULL, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_ObjectParser::EndBlob(), CLDS2_DataLoader::GetRecords(), and GetSynonyms().
SLDS2_Blob CLDS2_Database::GetBlobInfo | ( | const CSeq_id_Handle & | idh | ) |
Find blob containing the requested bioseq.
Return empty info if the seq-id is unknown or there are multiple bioseqs with the same id.
Definition at line 736 of file lds2_db.cpp.
References CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), info, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_InitGetBioseqsSql().
Referenced by CLDS2_DataLoader::GetBlobById(), CLDS2_DataLoader::GetBlobId(), and CLDS2_DataLoader::GetChunk().
SLDS2_Blob CLDS2_Database::GetBlobInfo | ( | Int8 | blob_id | ) |
Get blob info by blob id.
Definition at line 758 of file lds2_db.cpp.
References _ASSERT, CSQLITE_Statement::Bind(), eSt_GetBlobInfo, CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), info, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Get database file name.
Definition at line 264 of file lds2_db.hpp.
References m_DbFile.
Referenced by CLDS2_Manager::GetDbFile(), CLDS2_DataLoader::GetLoaderNameFromArgs(), and CLDS2_Manager::UpdateData().
SLDS2_File CLDS2_Database::GetFileInfo | ( | const string & | file_name | ) | const |
Get complete file info.
Definition at line 779 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetFileInfoByName, file_name, CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), CSQLITE_Statement::GetString(), info, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_DataLoader::GetChunk(), CLDS2_Manager::UpdateData(), and CLDS2_DataLoader::x_LoadTSE().
SLDS2_File CLDS2_Database::GetFileInfo | ( | Int8 | file_id | ) |
Get file info.
Definition at line 798 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetFileInfoById, CSQLITE_Statement::GetInt(), CSQLITE_Statement::GetInt8(), CSQLITE_Statement::GetString(), info, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
void CLDS2_Database::GetFileNames | ( | TStringSet & | files | ) | const |
Get all known file names.
Definition at line 472 of file lds2_db.cpp.
References eSt_GetFileNames, CSQLITE_Statement::GetString(), set< Key, Compare >::insert(), CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_Manager::UpdateData().
Get seq-id for the given lds-id.
Definition at line 997 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetSeq_idForLdsSeqId, CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), x_BlobToSeq_id(), and x_GetStatement().
|
inline |
Get SQLite flags, see CSQLITE_Connection::TOperationFlags.
Definition at line 267 of file lds2_db.hpp.
References m_DbFlags.
void CLDS2_Database::GetSynonyms | ( | const CSeq_id_Handle & | idh, |
TLdsIdSet & | ids | ||
) |
Get all lds-id synonyms for the seq-id (including lds-id for the seq-id itself).
Return empty set if there is a conflict.
Definition at line 683 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetSynonyms, GetBioseqId(), CSQLITE_Statement::GetInt8(), set< Key, Compare >::insert(), CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by CLDS2_DataLoader::GetIds().
void CLDS2_Database::GetSynonyms | ( | const CSeq_id_Handle & | idh, |
TSeqIds & | ids | ||
) |
Get all synonyms for the seq-id (including the original seq-id).
Return empty set on conflict.
Definition at line 699 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), eSt_GetSeq_idSynonyms, GetBioseqId(), CSeq_id_Handle::GetHandle(), CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), x_BlobToSeq_id(), and x_GetStatement().
void CLDS2_Database::Open | ( | EAccessMode | mode = eWrite | ) |
Open LDS2 database. If the database does not exist, throws exception.
Definition at line 465 of file lds2_db.cpp.
References SetAccessMode(), and x_GetConn().
Referenced by CLDS2_Manager::UpdateData().
|
private |
void CLDS2_Database::PrepareUpdate | ( | void | ) |
Prepare to update the DB.
Drop most indexes. To rebuild the indexes call Analyze.
void CLDS2_Database::SetAccessMode | ( | EAccessMode | mode | ) |
Set new access mode, re-open the database.
Definition at line 456 of file lds2_db.cpp.
References m_Mode, and x_ResetDbConnection().
void CLDS2_Database::SetSQLiteFlags | ( | int | flags | ) |
Set SQLite flags. This funtion resets the db connection.
Definition at line 449 of file lds2_db.cpp.
References flags, m_DbFlags, and x_ResetDbConnection().
void CLDS2_Database::UpdateFile | ( | SLDS2_File & | info | ) |
Update info for the known file. The 'id' of the info will change.
Definition at line 498 of file lds2_db.cpp.
References AddFile(), DeleteFile(), Info(), info, and LOG_POST_X.
Referenced by CLDS2_Manager::UpdateData().
|
private |
Definition at line 978 of file lds2_db.cpp.
References AutoPtr< X, Del >::get(), CSQLITE_Statement::GetBlob(), CSQLITE_Statement::GetInt(), in(), MSerial_AsnBinary, and CRef< C, Locker >::Reset().
Referenced by GetAnnots(), GetSeq_idForLdsSeqId(), and GetSynonyms().
|
private |
Definition at line 419 of file lds2_db.cpp.
References conn, i, len, and x_GetConn().
Referenced by BeginUpdate(), Create(), and EndUpdate().
|
private |
Definition at line 376 of file lds2_db.cpp.
References CLDS2_Database::SLDS2_DbConnection::Connection, CSQLITE_Connection::CreateInMemoryDatabase(), eMemory, eRead, eWrite, CSQLITE_Connection::fReadOnly, int, LDS2_THROW, m_DbFile, m_DbFlags, m_Mode, and x_GetDbConnection().
Referenced by Analyze(), BeginRead(), BeginUpdate(), Dump(), EndRead(), EndUpdate(), Open(), x_ExecuteSqls(), and x_GetStatement().
|
private |
Definition at line 343 of file lds2_db.cpp.
References m_DbConn, and m_DbInitMutex.
Referenced by x_GetConn(), and x_GetStatement().
|
private |
Definition at line 526 of file lds2_db.cpp.
References CSQLITE_Statement::Bind(), buf, eIdOriginal, eSt_AddLdsSeqId, eSt_GetLdsSeqIdForIntId, eSt_GetLdsSeqIdForTxtId, CSQLITE_Statement::Execute(), CSQLITE_Statement::GetInt8(), CSQLITE_Statement::GetLastInsertedRowid(), GI_TO, MSerial_AsnBinary, NULL, out(), CSQLITE_Statement::Reset(), CSQLITE_Statement::Step(), and x_GetStatement().
Referenced by AddAnnot(), and AddBioseq().
|
private |
Definition at line 402 of file lds2_db.cpp.
References _ASSERT, conn, AutoPtr< X, Del >::get(), AutoPtr< X, Del >::reset(), CSQLITE_Statement::Reset(), s_LDS2_SQL, sql, CLDS2_Database::SLDS2_DbConnection::Statements, x_GetConn(), and x_GetDbConnection().
Referenced by AddAnnot(), AddBioseq(), AddBlob(), AddChunk(), AddFile(), DeleteFile(), FindChunk(), GetAnnotBlobs(), GetAnnotCountForBlob(), GetAnnots(), GetBioseqId(), GetBlobInfo(), GetFileInfo(), GetFileNames(), GetSeq_idForLdsSeqId(), GetSynonyms(), x_GetLdsSeqId(), and x_InitGetBioseqsSql().
|
private |
Definition at line 720 of file lds2_db.cpp.
References _ASSERT, CSeq_id_Handle::AsString(), CSQLITE_Statement::Bind(), eSt_GetBioseqForIntId, eSt_GetBioseqForTxtId, CSeq_id_Handle::GetGi(), GI_TO, CSeq_id_Handle::IsGi(), NULL, and x_GetStatement().
Referenced by GetBioseqBlobs(), and GetBlobInfo().
|
private |
Definition at line 363 of file lds2_db.cpp.
References m_DbConn, and m_DbInitMutex.
Referenced by Create(), SetAccessMode(), and SetSQLiteFlags().
|
mutableprivate |
Definition at line 478 of file lds2_db.hpp.
Referenced by x_GetDbConnection(), and x_ResetDbConnection().
|
private |
Definition at line 474 of file lds2_db.hpp.
Referenced by Create(), GetDbFile(), and x_GetConn().
|
private |
Definition at line 475 of file lds2_db.hpp.
Referenced by GetSQLiteFlags(), SetSQLiteFlags(), and x_GetConn().
|
mutableprivate |
Definition at line 477 of file lds2_db.hpp.
Referenced by x_GetDbConnection(), and x_ResetDbConnection().
|
private |
Definition at line 479 of file lds2_db.hpp.
Referenced by BeginRead(), EndRead(), GetAccessMode(), SetAccessMode(), and x_GetConn().