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;
86 
87  char *awar_ere;
88  char *awar_where;
89  char *awar_by;
90  char *awar_use_tag;
92  char *awar_deftag;
93  char *awar_tag;
94  char *awar_count;
95  char *awar_sort;
96 
97  unsigned long sort_mask; // contains several cascading sort criteria (QUERY_SORT_CRITERIA_BITS each)
98 
100 
102  int select_bit; // one of 1 2 4 8 .. 128 (one for each query box)
103  GB_HASH *hit_description; // key = char* (hit item name), value = char* (description of hit - allocated!)
104 
105  DbQuery(ItemSelector& selector_)
106  : selector(selector_)
107  {
108  dbq_assert(&selector);
109  }
110  ~DbQuery();
111 
112  bool is_queried(GBDATA *gb_item) const {
113  return GB_user_flag(gb_item, select_bit);
114  }
115 
116  const char *get_tree_name() const;
117  void set_tree_awar_name(const char *tree_awar_name) { // @@@ intermediate - should be set by ctor
118  awar_tree_name = tree_awar_name;
119  }
120 
122  };
123 
124 };
125 #else
126 #error db_query_local.h included twice
127 #endif // DB_QUERY_LOCAL_H
128 
129 
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:2286
bool GB_user_flag(GBDATA *gbd, unsigned char user_bit)
Definition: arbdb.cxx:2714
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:900
DbQuery(ItemSelector &selector_)
unsigned long sort_mask
#define dbq_assert(cond)
char * awar_protectkey
bool is_queried(GBDATA *gb_item) const
char * awar_double_pars
char * awar_queries[QUERY_EXPRESSIONS]