41 WITH RECURSIVE descendants_from(taxid, parent) AS
44 SELECT T.taxid, T.parent
45 FROM descendants_from D, TaxidInfo T
46 WHERE D.taxid = T.parent)
47 SELECT taxid from descendants_from;
56 oss <<
"Database '" <<
kFileName <<
"' not found";
80 {
"table",
"TaxidInfo" },
81 {
"index",
"TaxidInfoCompositeIdx_parent" }
83 const string kSqlStmt =
84 "SELECT COUNT(*) FROM sqlite_master WHERE type=? and name=?;";
85 for (
auto& [
type, name] : kRequiredElements) {
91 if (s->GetInt(0) != 1) {
93 oss <<
"Database '" <<
m_DbName <<
"' does not have " <<
type;
94 oss <<
" " << name <<
". Please run the following command or ";
95 oss <<
"contact your system administrator to install it:" << endl;
96 oss <<
"update_blastdb.pl --decompress taxdb";
101 oss <<
"Failed to check for " <<
type <<
" " << name <<
" in '";
111 if (taxid <= 0)
return;
123 if (desc_taxid != taxid)
124 descendants.push_back(desc_taxid);
static const char * kFileName
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Connection to SQLite database.
int TOperationFlags
Bit mask of EOperationFlags.
@ fExternalMT
Object and all statements and blobs created on top of it will not be used from different threads simu...
@ fJournalOff
Journaling is completely off (not recommended - transactions cannot be rollbacked unless they consist...
@ fSyncOff
Synchronization is off, database can be corrupted on OS crash or power outage.
@ fReadOnly
The DB is read-only. Also forces fVacuumOff flag.
@ fVacuumOff
Vacuuming is off, database file can only grow.
@ fTempToMemory
Mode of storing temporary data.
SQL statement executing on SQLite database.
static const string kDefaultName
Default name for SQLite database (by default installed in $BLASTDB)
void x_SanityCheck()
Simple sanity check to validate the integrity of the database.
unique_ptr< CSQLITE_Statement > m_Statement
Most recent SQLite statement.
virtual void GetLeafNodeTaxids(const int taxid, vector< int > &descendants)
@inheritDoc
string m_DbName
SQLite3 database file name.
virtual ~CTaxonomy4BlastSQLite()
Destructor.
CTaxonomy4BlastSQLite(const string &dbname=kEmptyStr)
Parametrized constructor, uses its arguments to initialize database.
unique_ptr< CSQLITE_Connection > m_DbConn
Connection to SQLite engine.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Defines: CTimeFormat - storage class for time format.
Defines exception class and several constants for SeqDB.
string SeqDB_ResolveDbPath(const string &filename)
Resolve a file path using SeqDB's path algorithms.