00001 /******************************************************************************/ 00002 /* */ 00003 /* POLiTe - Persistent Object Library Test */ 00004 /* Ph.D. Thesis by Mgr. Michal Kopecky */ 00005 /* */ 00006 /* Charles University Prague */ 00007 /* */ 00008 /******************************************************************************/ 00009 /* */ 00010 /* File name: ... */ 00011 /* Module: ...... */ 00012 /* */ 00013 /******************************************************************************/ 00014 00015 #ifndef __C_QUERY_H__ 00016 #define __C_QUERY_H__ 00017 00018 // Common POLiTe Header(s) 00019 #include <lDefs.h> 00020 #include <lStr.h> 00021 00022 // Parent Header(s) 00023 #include <cQueRefProto.h> 00024 00025 extern DLL_External const class Query ALL; 00026 extern DLL_External const class Query NONE; 00027 extern DLL_External const class Query EQUERY; 00028 00029 class DLL_External Query: public QueRefProto { 00030 #ifdef POLITE_TEST_FRIEND 00031 friend POLITE_TEST_FRIEND; 00032 #endif // POLITE_TEST_FRIEND 00033 00034 friend class ObjRef; 00035 friend class Relation; 00036 friend class ProtoBase; 00037 friend class OneToOneRelationBase; 00038 friend class OneToManyRelationBase; 00039 friend class ManyToOneRelationBase; 00040 friend class ManyToManyRelationBase; 00041 friend class ChainedRelationBase; 00042 00043 protected: 00044 char *_where; 00045 char *_order_by; 00046 00047 public: 00048 Query( 00049 const char *const a_where = NULL, 00050 const char *const a_order_by = NULL 00051 ); 00052 00053 Query( 00054 const QueRefProto &X 00055 ); 00056 00057 Query( 00058 const Query &X 00059 ); 00060 00061 virtual ~Query(); 00062 00063 virtual char *Where() const {return _where;}; 00064 00065 virtual bool Where(const char * const a_where); 00066 00067 virtual char *OrderBy() const {return _order_by;}; 00068 00069 virtual bool OrderBy(const char * const a_order_by); 00070 00071 Query &Not(); //Provides query negation. 00072 00073 Query &Or(const QueRefProto &Q); //Provides disjunction of two queries. 00074 00075 Query &And(const QueRefProto &Q); //Provides conjunction of two queries. 00076 00077 Query &Query::operator =(const QueRefProto &X); 00078 Query &Query::operator =(const Query &X); 00079 00080 protected: 00081 virtual char *_Where() const; 00082 virtual char *_OrderBy() const; 00083 00084 }; 00085 00086 #endif //__C_QUERY_H__