kexi
indexschema.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXIDB_INDEX_H
00021 #define KEXIDB_INDEX_H
00022
00023 #include <qvaluelist.h>
00024 #include <qstring.h>
00025
00026 #include <kexidb/fieldlist.h>
00027 #include <kexidb/schemadata.h>
00028 #include <kexidb/relationship.h>
00029
00030 namespace KexiDB {
00031
00032 class Connection;
00033 class TableSchema;
00034 class QuerySchema;
00035 class Relationship;
00036
00043 class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData
00044 {
00045 public:
00046 typedef QPtrList<IndexSchema> List;
00047 typedef QPtrListIterator<IndexSchema> ListIterator;
00048
00055 IndexSchema(TableSchema *tableSchema);
00056
00068 IndexSchema(const IndexSchema& idx, TableSchema& parentTable);
00069
00075 virtual ~IndexSchema();
00076
00080 virtual FieldList& addField(Field *field);
00081
00083 TableSchema* table() const;
00084
00089 Relationship::List* masterRelationships() { return &m_master_rels; }
00090
00094 Relationship::List* detailsRelationships() { return &m_details_rels; }
00095
00105 void attachRelationship(Relationship *rel);
00106
00115 void detachRelationship(Relationship *rel);
00116
00132 bool isAutoGenerated() const;
00133
00136 bool isPrimaryKey() const;
00137
00141 void setPrimaryKey(bool set);
00142
00145 bool isUnique() const;
00146
00151 void setUnique(bool set);
00152
00154 virtual QString debugString();
00155 protected:
00156
00164
00165
00169 void setAutoGenerated(bool set);
00170
00176 void setForeignKey(bool set);
00177
00180 void attachRelationship(Relationship *rel, bool ownedByMaster);
00181
00182 TableSchema *m_tableSchema;
00183
00188 Relationship::List m_master_owned_rels;
00189
00191 Relationship::List m_master_rels;
00192
00194 Relationship::List m_details_rels;
00195
00196 bool m_primary : 1;
00197 bool m_unique : 1;
00198 bool m_isAutoGenerated : 1;
00199 bool m_isForeignKey : 1;
00200
00201 friend class Connection;
00202 friend class TableSchema;
00203 friend class QuerySchema;
00204 friend class Relationship;
00205 };
00206
00207 }
00208
00209 #endif
|