ARB
db_query_local.h
Go to the documentation of this file.
1 // ============================================================ //
2 // //
3 // File : db_query_local.h //
4 // Purpose : internal query defs //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================ //
10 
11 #ifndef DB_QUERY_LOCAL_H
12 #define DB_QUERY_LOCAL_H
13 
14 #ifndef ARBDBT_H
15 #include <arbdbt.h>
16 #endif
17 #ifndef DB_QUERY_H
18 #include "db_query.h"
19 #endif
20 
21 #define dbq_assert(cond) arb_assert(cond)
22 
24 class QueryExpr;
25 
26 namespace QUERY {
27 
28  enum QUERY_MODES {
32  };
33 
34  enum QUERY_TYPES {
38  };
39 
40 #define QUERY_EXPRESSIONS 3 // no of search-lines in search tool
41 
42 #define QUERY_SORT_CRITERIA_BITS 7 // number of "real" sort criteria
43 #define QUERY_SORT_CRITERIA_MASK ((1<<QUERY_SORT_CRITERIA_BITS)-1)
44 
47 
48  // "real" criteria (do not change values, will break existing macro-code):
49  QUERY_SORT_BY_1STFIELD_CONTENT = 1, // by content of first selected search field
50  QUERY_SORT_BY_ID = 2, // by item id (not by parent)
51  QUERY_SORT_BY_NESTED_PID = 4, // by nested parent id
52  QUERY_SORT_BY_MARKED = 8, // marked items first
53  QUERY_SORT_BY_HIT_DESCRIPTION = 16, // by hit description
54  QUERY_SORT_REVERSE = 32, // revert following (may occur multiple times)
55  QUERY_SORT_NUM_BY_1STFIELD_CONTENT = 64, // by content of first selected search field (numerically)
56 
57  };
58 
59  class DbQuery : virtual Noncopyable {
60  AwarName awar_tree_name;
61 
62  public:
64  GBDATA *gb_main; // the main database (in merge tool: source db in left query; dest db in right query)
65  GBDATA *gb_ref; // second reference database (only used by merge tool; dest db in left query; source db in right query)
66  bool expect_hit_in_ref_list; // merge-tool: when searching dups in fields: match only if hit exists in other DBs hitlist (true for target-DB-query)
67 
70  char *awar_not[QUERY_EXPRESSIONS]; // not flags for queries
71  char *awar_operator[QUERY_EXPRESSIONS]; // not flags for queries
72 
73  char *species_name;
74 
77 
81 
82  char *awar_parskey;
87 
88  char *awar_ere;
89  char *awar_where;
90  char *awar_by;
91  char *awar_use_tag;
93  char *awar_deftag;
94  char *awar_tag;
95  char *awar_count;
96  char *awar_sort;
97 
98  unsigned long sort_mask; // contains several cascading sort criteria (QUERY_SORT_CRITERIA_BITS each)
99 
101 
103  int select_bit; // one of 1 2 4 8 .. 128 (one for each query box)
104  GB_HASH *hit_description; // key = char* (hit item name), value = char* (description of hit - allocated!)
105 
106  DbQuery(ItemSelector& selector_)
107  : selector(selector_)
108  {
109  dbq_assert(&selector);
110  }
111  ~DbQuery();
112 
113  bool is_queried(GBDATA *gb_item) const {
114  return GB_user_flag(gb_item, select_bit);
115  }
116 
117  const char *get_tree_name() const;
118  void set_tree_awar_name(const char *tree_awar_name) { // @@@ intermediate - should be set by ctor
119  awar_tree_name = tree_awar_name;
120  }
121 
123  };
124 
125 };
126 #else
127 #error db_query_local.h included twice
128 #endif // DB_QUERY_LOCAL_H
129 
130 
void set_tree_awar_name(const char *tree_awar_name)
char * awar_writekey
char * awar_writelossy
char * awar_parsvalue
#define QUERY_EXPRESSIONS
char * awar_acceptConvError
char * awar_keys[QUERY_EXPRESSIONS]
const char * get_tree_name() const
Definition: db_query.cxx:2293
bool GB_user_flag(GBDATA *gbd, unsigned char user_bit)
Definition: arbdb.cxx:2750
char * awar_setprotection
GB_HASH * hit_description
bool expect_hit_in_ref_list
QUERY_RESULT_ORDER
char * awar_setvalue
AW_selection_list * hitlist
GBDATA * gb_main
AW_window * aws
ItemSelector & selector
char * awar_operator[QUERY_EXPRESSIONS]
char * awar_parspredefined
Definition: db_query.h:24
char * awar_not[QUERY_EXPRESSIONS]
SmartPtr< QueryExpr > buildQueryExpr()
Definition: db_query.cxx:897
DbQuery(ItemSelector &selector_)
unsigned long sort_mask
#define dbq_assert(cond)
char * awar_acceptIdMod
char * awar_protectkey
bool is_queried(GBDATA *gb_item) const
char * awar_double_pars
char * awar_queries[QUERY_EXPRESSIONS]