kexi
relationship.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXIDB_RELATIONSHIP_H
00021 #define KEXIDB_RELATIONSHIP_H
00022
00023 #include <kexidb/field.h>
00024
00025 namespace KexiDB {
00026
00073 class IndexSchema;
00074 class TableSchema;
00075 class QuerySchema;
00076
00077 class KEXI_DB_EXPORT Relationship
00078 {
00079 public:
00080 typedef QPtrList<Relationship> List;
00081 typedef QPtrListIterator<Relationship> ListIterator;
00082
00086 Relationship();
00087
00091 Relationship(IndexSchema* masterIndex, IndexSchema* detailsIndex);
00092
00093 virtual ~Relationship();
00094
00097 IndexSchema* masterIndex() const { return m_masterIndex; }
00098
00101 IndexSchema* detailsIndex() const { return m_detailsIndex; }
00102
00106 Field::PairList* fieldPairs() { return &m_pairs; }
00107
00108 bool isEmpty() const { return m_pairs.isEmpty(); }
00109
00112 TableSchema* masterTable() const;
00113
00116 TableSchema* detailsTable() const;
00117
00129 void setIndices(IndexSchema* masterIndex, IndexSchema* detailsIndex);
00130
00131 protected:
00132 Relationship( QuerySchema *query, Field *field1, Field *field2 );
00133
00134 void createIndices( QuerySchema *query, Field *field1, Field *field2 );
00135
00138 void setIndices(IndexSchema* masterIndex, IndexSchema* detailsIndex, bool ownedByMaster);
00139
00140 IndexSchema *m_masterIndex;
00141 IndexSchema *m_detailsIndex;
00142
00143 Field::PairList m_pairs;
00144
00145 bool m_masterIndexOwned : 1;
00146 bool m_detailsIndexOwned : 1;
00147
00148 friend class Connection;
00149 friend class TableSchema;
00150 friend class QuerySchema;
00151 friend class IndexSchema;
00152 };
00153
00154 }
00155
00156 #endif
|