: m_NodeType(eLogical)
62: m_NodeType(eOperator),
99 BDB_THROW(eQueryError,
"Incorrect query node type");
108 BDB_THROW(eQueryError,
"Incorrect query node type");
234 string& fvalue = qnode.
GetValue();
235 size_t len= fvalue.length();
237 if(fvalue[0] ==
'\''&& fvalue[
len-1] ==
'\'') {
351 const string& search_value,
352 unsigned intarg_idx)
362 unsigned intarg_idx)
381TTree::TNodeList_CI it_end = tr.
SubNodeEnd();
384 for(
unsigned i= 0; it != it_end; ++it, ++
i) {
385 constTTree*
t= *it;
417 const string& v = qnode.
GetValue();
418 const char* sz =
"0";
437 const string*
GetArg(
size_tidx)
const 463TArgVector::size_type old_size =
m_ArgVector.size();
464 _ASSERT(new_size <= old_size + 1);
465 if(new_size > old_size) {
497 for(
size_t i= 0;
i<
size; ++
i) {
527 const string* arg0 =
GetArg(0);
528 const string* arg1 =
GetArg(1);
537 if(fld0 != 0 && fld1 == 0) {
539 size_tpos = matcher->
Search(*arg0);
548 if(fld0 == 0 && fld1 != 0) {
550 size_tpos = matcher->
Search(*arg1);
561 boolres = (*arg0 == *arg1);
584 const string* arg0 =
GetArg(0);
585 const string* arg1 =
GetArg(1);
587 intcmpres = arg0->compare(*arg1);
607 boolres = cmpres > 0;
626 boolres = cmpres >= 0;
645 boolres = cmpres < 0;
665 boolres = cmpres <= 0;
690 for(
size_t i= 0;
i<
size; ++
i) {
691 const string* arg =
GetArg(
i);
722 for(
size_t i= 0;
i<
size; ++
i) {
723 const string* arg =
GetArg(
i);
750 const string* arg =
GetArg(0);
797 query.ResetQueryClause();
815 query.ResetQueryClause();
871 const string& search_value = qnode.
GetValue();
976 const string& v = qnode.
GetValue();
1042 if(qnode.
IsNot()) {
Berkeley BDB file cursor.
static CBoyerMooreMatcher * s_MakeNewMatcher(const string &search_value)
Create new matcher.
static ETreeTraverseCode s_ResetQueryNode(CTreeNode< CBDB_QueryNode > &tr, int delta)
Reset all intermidiate results of tree evaluation (values) value constants will not be destroyed.
Base class for constructing BDB fields.
Berkeley DB file cursor class.
Query class incapsulates query tree (query clause) and implements set of utility methods to construct...
This implemetation uses the Boyer-Moore alg.
Query execition environment.
CBDB_File & GetFile(void)
CQueryExecEnv(const CQueryExecEnv &qenv)
CQueryExecEnv & operator=(const CQueryExecEnv &qenv)
CQueryExecEnv(CBDB_File &db_file)
CResourcePool< string > & GetStrPool()
CResourcePool< string > m_StrPool
Query database file.
Field resolution functor.
CQueryTreeFieldResolveFunc(CBDB_File &db_file)
ETreeTraverseCode operator()(CTreeNode< CBDB_QueryNode > &tr, int delta)
The main tree printing functor class.
CQueryTreePrintFunc(CNcbiOstream &os)
ETreeTraverseCode operator()(const CTreeNode< CBDB_QueryNode > &tr, int delta)
The main tree evaluation functor.
CScannerEvaluateFunc(CQueryExecEnv &env)
CScannerEvaluateFunc(const CScannerEvaluateFunc &func)
ETreeTraverseCode operator()(CTreeNode< CBDB_QueryNode > &tr, int delta)
CQueryExecEnv & m_QueryEnv
CBoyerMooreMatcher * m_Matcher
CScannerFunctorAND(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
Base class for N argument functions.
const CBDB_Field * GetArgField(size_t idx) const
CScannerFunctorArgN(CQueryExecEnv &env)
void GetArguments(CTreeNode< CBDB_QueryNode > &tr, EAllFieldsCheck check_mode=eNoCheck)
Extract function arguments from the parsing tree.
vector< const CBDB_Field * > TFieldVector
If argument is a db field corresponding vector element contains the field pointer.
CBoyerMooreMatcher * GetMatcher(const string &search_value, unsigned int arg_idx)
bool IsAnyField(CBDB_File &dbf, const string &search_value, unsigned int arg_idx)
Checks if value is equal to any field in the database.
void SyncArgValue(unsigned int idx, CResourcePool< string > &str_pool)
m_ArgVector[idx] = m_ArgValueVector[idx]
vector< CBoyerMooreMatcher * > TStringMatcherVector
String matchers used for substring search.
TArgValueVector m_ArgValueVector
TStringMatcherVector m_MatcherVector
TFieldVector m_FieldVector
const string * GetArg(size_t idx) const
void ResizeVectors(unsigned int new_size)
Syncronously resize all arguments vectors.
vector< string * > TArgValueVector
Vector of strings borrowed from the query environment pool to keep temporary values during the query ...
vector< const string * > TArgVector
Vector of arguments, elements can point on values from TArgValueVector or variables located in the qu...
EAllFieldsCheck
Enum indicates how to interpret the plain value tree elements.
void SetResult(CBDB_QueryNode &qnode, bool res)
Basic class for all comparison (GT, LT, etc) functors.
int CmpEval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorComp(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorEQ(CQueryExecEnv &env, bool not_flag)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorGE(CQueryExecEnv &env)
CScannerFunctorGT(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorLE(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorLT(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorNOT(CQueryExecEnv &env)
void Eval(CTreeNode< CBDB_QueryNode > &tr)
CScannerFunctorOR(CQueryExecEnv &env)
Base class for functions of the evaluation engine.
CScannerFunctor(CQueryExecEnv &env)
CQueryExecEnv & m_QueryEnv
CScannerFunctor(const CScannerFunctor &)
CScannerFunctor & operator=(const CScannerFunctor &)
definition of a Culling tree
static const char * str(char *buf, int n)
const CBDB_Field & GetField(TUnifiedFieldIndex idx) const
Return field by field index.
void SetCondition(ECondition cond_from, ECondition cond_to=eNotSet)
Set search condition(type of interval)
TUnifiedFieldIndex GetFieldIdx(const string &name) const
Get field index by name.
int TUnifiedFieldIndex
CBDB_File keeps data in two buffers (key buffer and data buffer).
EBDB_ErrCode Fetch(EFetchDirection fdir=eDefault)
Fetch record.
CTreeNode< CBDB_QueryNode > TQueryClause
ENodeType GetType() const
ELogicalType
Subtype of ENodeType - eLogical.
union CBDB_QueryNode::@103 m_SubType
const string & GetAltValue() const
Get alternative value.
CBDB_File & m_File
Searched BDB file.
EScanAction
Scanner control codes.
const string & GetValue() const
void Scan(CBDB_Query &query)
Scan the BDB file, search the qualified records When record found function calls OnRecordFound.
virtual EScanAction OnRecordFound()
Called when scanner finds a record matching the query terms Function returns a control code (EScanAct...
CBDB_QueryNode & operator=(const CBDB_QueryNode &qnode)
EOperatorType
Subtype of ENodeType - eOperator.
void SetValue(const string &value)
void BDB_PrintQueryTree(CNcbiOstream &os, const CBDB_Query &query)
Function prints the query tree on the specified ostream (Intended more for debugging purposes)
ELogicalType GetLogicType() const
TQueryClause * m_QueryClause
EOperatorType GetOperatorType() const
void SetField(int field_idx)
Set node type to eDBField.
void SetQueryClause(TQueryClause *query_clause)
Replace current query clause with the new one.
void SetAltValue(const string &v)
Set alternative value.
CBDB_FileScanner(CBDB_File &db_file)
static TQueryClause * NewLogicalNode(CBDB_QueryNode::ELogicalType otype, TQueryClause *arg1, TQueryClause *arg2)
Creates new logical node of the query.
void ResolveFields(CBDB_Query &query)
bool m_NotFlag
Inverted function.
static TQueryClause * NewOperatorNode(CBDB_QueryNode::EOperatorType otype, const string &arg1, const string &arg2)
Creates new operator node of the query Caller is responsible for destruction (in most cases the resul...
bool Evaluate(CBDB_Query &query)
Returns TRUE if file record matches the query.
CBDB_QueryNode(string value=kEmptyStr)
Constuction of value type node.
CBDB_Query(TQueryClause *qc=0)
Contruct the query.
virtual ~CBDB_FileScanner()
@ eStop
Stop search process.
@ eContinue
Keep scanning.
bool IsNull() const
Return TRUE if field is NULL.
virtual void ToString(string &str) const =0
CBDB_File::TUnifiedFieldIndex BDB_find_field(const CBDB_File &dbf, const CBoyerMooreMatcher &matcher, string *tmp_str_buffer=0)
Find index of field containing the specified value Search condition is specified by CBoyerMooreMatche...
#define BDB_THROW(errcode, message)
Value * Get()
Get object from the pool.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
void InitCommonDelimiters()
Init delimiters most common for the English language, (whitespaces, punctuations, etc)
size_t Search(const string &text, size_t pos=0) const
Search for the pattern over text starting at position pos.
@ eNocase
Case insensitive compare.
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
TNodeList_CI SubNodeBegin(void) const
Return first const iterator on subnode list.
bool IsLeaf() const
Report whether this is a leaf node.
TNodeList_CI SubNodeEnd(void) const
Return last const iterator on subnode list.
const TValue & GetValue(void) const
Return node's value.
const TTreeType * GetParent(void) const
Get node's parent.
@ eTreeTraverse
Keep traversal.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Int4 delta(size_t dimension_, const Int4 *score_)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4