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

cManyToOneRelationBase.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 __GC_RELN1_H__
00016 #define __GC_RELN1_H__
00017 
00018 // Parent Header(s)
00019 #include <cRelation.h>
00020 
00021 class DLL_External ManyToOneRelationBase : public Relation {
00022 #ifdef POLITE_TEST_FRIEND
00023         friend POLITE_TEST_FRIEND;
00024 #endif // POLITE_TEST_FRIEND
00025 
00026 public:
00027         ManyToOneRelationBase(
00028                 const char *a_left_class_name,
00029                 const char *a_right_class_name,
00030                 const char *a_table_name,
00031                 class Connection *a_database_connection,
00032                 const char *a_left_column_name = NULL,
00033                 const char *a_right_column_name = NULL
00034                 );
00035 
00036         virtual bool InsertCouple(RefBase &left, RefBase &right); //Inserts a couple <L, R> to the OMT-relation.
00037 
00038         virtual bool DeleteCouple(RefBase &left, RefBase &right); //Deletes a couple <L, R> from the OMT-relation.
00039 
00040         virtual bool LDeleteAll(class RefBase &right);
00041         //Deletes all couples <X, right>
00042 
00043         virtual bool RDeleteAll(class RefBase &left);
00044         //Deletes all couples <left, X>
00045 
00046         virtual bool WriteDDL(ofstream &S, class Database &Db);
00047         // generates DDL stements nedded for the library to run
00048 
00049 protected:
00050         virtual class ResultBase *_LGetAll(
00051                 ResultBase *rb,
00052                 const class RefBase &right,
00053                 const class QueRefProto &query = EQUERY
00054                 );
00055         //Gets all objects connected to object "right"
00056         //according to "query"
00057 
00058         virtual ResultBase *_RGetAll(
00059                 ResultBase *rb,
00060                 const class RefBase &left,
00061                 const class QueRefProto &query = EQUERY
00062                 );
00063         //Gets all objects connected to object "left"
00064         //according to "query"
00065 
00066 public:
00067         virtual bool ExistsCouple(
00068                 const class RefBase &left,
00069                 const class RefBase &right
00070         );
00071         //Tests if exists relation between the given objects
00072 
00073 /*
00074    OneToManyRelationBase operator -() const;
00075    //Returns inverse relation
00076 */
00077 
00078         ManyToOneRelationBase(const ManyToOneRelationBase &R):
00079         Relation(
00080                 R._leftClassName,
00081                 R._rightClassName,
00082                 R._tableName,
00083                 R._databaseConnection,
00084                 R._leftColumnName,
00085                 R._rightColumnName
00086                 ) {};
00087         //Deep copy-constructor
00088 
00089 /*
00090         ManyToOneRelationBase &operator =(const ManyToOneRelationBase &R);
00091         //Returns copy of relation
00092 */
00093 
00094 protected:
00095         virtual const char *_TableName() const;
00096         // Returns a table name, where both sets of foreign keys are
00097         // it is NOT a _table_name column for all types of relations!
00098 
00099 };
00100 
00101 #endif //__GC_RELN1_H__

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