Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cChainedRelationBase.h

Go to the documentation of this file.
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_CHAINEDRELATIONBASE_H__
00016 #define __C_CHAINEDRELATIONBASE_H__
00017 
00018 // Parent Header(s)
00019 #include <cRelation.h>
00020 
00021 class DLL_External ChainedRelationBase : public Relation {
00022 #ifdef POLITE_TEST_FRIEND
00023         friend POLITE_TEST_FRIEND;
00024 #endif // POLITE_TEST_FRIEND
00025 
00026 friend class QueRefProto;
00027 friend class OneToOneRelationBase;
00028 friend class OneToManyRelationBase;
00029 friend class ManyToOneRelationBase;
00030 friend class ManyToManyRelationBase;
00031 
00032 protected:
00033         //Following attributes were added because of support of ChainedRelation, in other
00034         //types of relations they are not used:
00035         char *_inner_columns;
00036         //SQL fragment of joining columns "inside" ChainedRelation with aliases
00037         int _relnum;
00038         //Number of chained binary relations
00039         int _qnum;
00040         //Number of non-empty Queries inside the relation
00041         Query _left_query;
00042         Query _right_query;
00043 
00044 
00045 protected:
00046         ChainedRelationBase(
00047                 const char *a_left_class_name,
00048                 const char *a_right_class_name,
00049                 const char *a_table_name,
00050                 class Connection *a_database_connection,
00051                 const char *a_left_column_name,
00052                 const char *a_right_column_name,
00053                 const char *a_inner_columns,
00054                 const int a_relnum,
00055                 const int a_qnum,
00056                 const class Query &a_left_query,
00057                 const class Query &a_right_query
00058         );
00059 
00060         ChainedRelationBase(
00061                 const ChainedRelationBase &X,
00062                 const ChainedRelationBase &Y
00063         );
00064 
00065         ChainedRelationBase(
00066                 ProtoBase &X,
00067                 ProtoBase &Y
00068         );
00069 
00070 public:
00071         ~ChainedRelationBase();
00072         //Destructor of ChainedRelation
00073 
00074         virtual bool InsertCouple(RefBase &left, RefBase &right) {return false;};
00075         //Inserts a couple <L, R> to the OMT-relation.
00076 
00077         virtual bool DeleteCouple(RefBase &left, RefBase &right) {return false;};
00078         //Deletes a couple <L, R> from the OMT-relation.
00079 
00080         virtual bool LDeleteAll(class RefBase &right) {return false;};
00081         //Deletes all couples <X, right>
00082 
00083         virtual bool RDeleteAll(class RefBase &left) {return false;};
00084         //Deletes all couples <left, X>
00085 
00086         virtual bool WriteDDL(ofstream &S, class Database &Db);
00087         // generates DDL stements nedded for the library to run
00088 
00089 protected:
00090         virtual class ResultBase *_LGetAll(
00091                 ResultBase *rb,
00092                 const class RefBase &right,
00093                 const class QueRefProto &query = ALL
00094                 );
00095         //Gets all objects connected to object "right"
00096         //according to "query"
00097 
00098         virtual ResultBase *_RGetAll(
00099                 ResultBase *rb,
00100                 const class RefBase &left,
00101                 const class QueRefProto &query = ALL
00102                 );
00103         //Gets all objects connected to object "left"
00104         //according to "query"
00105 
00106 public:
00107         virtual bool ExistsCouple(
00108                 const class RefBase &left,
00109                 const class RefBase &right
00110         );
00111         //Tests if exists relation between the given objects
00112 
00113         ChainedRelationBase(const ChainedRelationBase &R);
00114         //Deep copy-constructor
00115 
00116 /*
00117         ChainedRelation operator *(const QueRefProto &const Q) const;
00118         //ChainedRelation = Relation * QueRefProto
00119 
00120         ChainedRelation operator *(const ChainedRelation &const R) const;
00121         //Binds together two ChainedRelations
00122 
00123         ChainedRelation operator &(const class Relation &const R) const;
00124         //Intersection of relations
00125 
00126         ChainedRelation operator |(const class Relation &const R) const;
00127         //Union of relations
00128 
00129         ChainedRelation operator -(const class Relation &const R) const;
00130         //Substraction of relations
00131 */
00132 
00133 protected:
00134         //Re-initialisation of the relation
00135         void _Init(
00136                 const char *a_left_class_name,
00137                 const char *a_right_class_name,
00138                 const char *a_table_name,
00139                 class Connection *a_database_connection,
00140                 const char *a_left_column_name,
00141                 const char *a_right_column_name,
00142                 const char *a_inner_columns,
00143                 const int a_relnum,
00144                 const int a_qnum,
00145                 const class Query &a_left_query,
00146                 const class Query &a_right_query
00147                 );
00148 
00149         virtual ResultBase *_LGetAll(
00150                 ResultBase * rb,
00151                 const class QueRefProto &qL,
00152                 const class QueRefProto &qR
00153                 );
00154         //Gets all objects on the left side fulfilling query qL connected to object
00155         //on the right fulfilling query qR
00156 
00157         virtual ResultBase *_RGetAll(
00158                 ResultBase * rb,
00159                 const class QueRefProto &qL,
00160                 const class QueRefProto &qR
00161                 );
00162         //Gets all objects on the right side fulfilling query qR connected to object
00163         //on the left fulfilling query qL
00164 
00165 };
00166 
00167 #endif //__C_CHAINEDRELATIONBASE_H__

Generated on Sun Jul 14 20:51:13 2002 for POLiTe by doxygen1.2.16