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

cRelation.cpp

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 // Common POLiTe Header(s)
00016 #include <lTrace.h>
00017 #include <lDefs.h>
00018 #include <lStr.h>
00019 
00020 // Own Header
00021 #include <cRelation.h>
00022 
00023 // Other POLiTe Header(s)
00024 #include <cResultBase.h>
00025 #include <cObject.h>
00026 
00027 Relation::Relation(
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,
00033         const char *a_right_column_name
00034         )
00035 {
00036         _leftClassName = a_left_class_name,
00037         _rightClassName = a_right_class_name,
00038         _databaseConnection = a_database_connection;
00039         _tableName = StrCpy(_tableName = NULL,a_table_name);
00040         StrCpy(_leftColumnName=NULL,a_left_column_name);
00041         StrCpy(_rightColumnName=NULL,a_right_column_name);
00042 };
00043 
00044 Relation::~Relation() {
00045         StrFree(_tableName);
00046         StrFree(_leftColumnName);
00047         StrFree(_rightColumnName);
00048 };
00049 
00050 bool Relation::InsertCouple(class Object &left, class RefBase &right)
00051 {
00052         RefBase l = left.Address();
00053         return InsertCouple(l, right);
00054 };
00055 
00056 bool Relation::InsertCouple(class RefBase &left, class Object &right)
00057 {
00058         RefBase r = right.Address();
00059         return InsertCouple(left, r);
00060 };
00061 
00062 bool Relation::InsertCouple(class Object &left, class Object &right)
00063 {
00064         RefBase l = left.Address();
00065         RefBase r = right.Address();
00066         return InsertCouple(l, r);
00067 };
00068 
00069 bool Relation::DeleteCouple(class Object &left, class RefBase &right)
00070 {
00071         RefBase l = left.Address();
00072         return DeleteCouple(l, right);
00073 };
00074 
00075 bool Relation::DeleteCouple(class RefBase &left, class Object &right)
00076 {
00077         RefBase r = right.Address();
00078         return DeleteCouple(left, r);
00079 };
00080 
00081 bool Relation::DeleteCouple(class Object &left, class Object &right)
00082 {
00083         RefBase l = left.Address();
00084         RefBase r = right.Address();
00085         return DeleteCouple(l, r);
00086 };
00087 
00088 bool Relation::LDeleteAll(class Object &right)
00089 {
00090         RefBase r = right.Address();
00091         return LDeleteAll(r);
00092 };
00093 
00094 bool Relation::RDeleteAll(class Object &left)
00095 {
00096         RefBase l = left.Address();
00097         return LDeleteAll(l);
00098 };
00099 
00100 bool Relation::LExists(
00101         const class RefBase &right,
00102         const class QueRefProto &query
00103         )
00104 //Tests if exists any object connected to object "right"
00105 {
00106         ResultBase *_QR;
00107         bool _Retval = false;
00108 
00109         #ifdef C_RELATION_TRACE
00110         logmsg("Relation::LExists(...) invoked");
00111         #endif
00112 
00113         if ((_QR = _LGetAll(new ResultBase,right,query))!=NULL) {
00114                 _Retval = _QR->First();
00115                 _QR->Close();
00116                 delete _QR;
00117                 };
00118 
00119         #ifdef C_RELATION_TRACE
00120         logmsg("Relation::LExists() finished");
00121         #endif
00122 
00123         return _Retval;
00124 };
00125 
00126 bool Relation::LExists(
00127         const class Object &right,
00128         const class QueRefProto &query
00129         )
00130 //Tests if exists any object connected to object "right"
00131 {
00132         return LExists(right.Address(), query);
00133 };
00134 
00135 bool Relation::RExists(
00136         const class RefBase &left,
00137         const class QueRefProto &query
00138         )
00139 //Tests if exists any object connected to object "left"
00140 {
00141         ResultBase *_QR;
00142         bool _Retval = false;
00143 
00144         #ifdef C_RELATION_TRACE
00145         logmsg("Relation::RExists(...) invoked");
00146         #endif
00147 
00148         if ((_QR = _RGetAll(new ResultBase,left,query))!=NULL) {
00149                 _Retval = _QR->First();
00150                 _QR->Close();
00151                 delete _QR;
00152                 };
00153 
00154         #ifdef C_RELATION_TRACE
00155         logmsg("Relation::RExists() finished");
00156         #endif
00157 
00158         return _Retval;
00159 };
00160 
00161 bool Relation::RExists(
00162         const class Object &left,
00163         const class QueRefProto &query
00164         )
00165 //Tests if exists any object connected to object "left"
00166 {
00167         return RExists(left.Address(), query);
00168 };
00169 
00170 bool Relation::ExistsCouple(const class Object &left,const class RefBase &right)
00171 {
00172         return ExistsCouple(left.Address(), right);
00173 };
00174 
00175 bool Relation::ExistsCouple(const class RefBase &left,const class Object &right)
00176 {
00177         return ExistsCouple(left, right.Address());
00178 };
00179 
00180 bool Relation::ExistsCouple(const class Object &left,const class Object &right)
00181 {
00182         return ExistsCouple(left.Address(), right.Address());
00183 };
00184 

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