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
00058 IndexSchema(const IndexSchema& idx);
00059
00065 virtual ~IndexSchema();
00066
00070 virtual FieldList& addField(Field *field);
00071
00073 TableSchema* table() const;
00074
00079 Relationship::List* masterRelationships() { return &m_master_rels; }
00080
00084 Relationship::List* detailsRelationships() { return &m_details_rels; }
00085
00095 void attachRelationship(Relationship *rel);
00096
00105 void detachRelationship(Relationship *rel);
00106
00122 bool isAutoGenerated() const;
00123
00126 bool isPrimaryKey() const;
00127
00131 void setPrimaryKey(bool set);
00132
00135 bool isUnique() const;
00136
00141 void setUnique(bool set);
00142
00144 virtual QString debugString();
00145 protected:
00146
00154
00155
00159 void setAutoGenerated(bool set);
00160
00166 void setForeignKey(bool set);
00167
00170 void attachRelationship(Relationship *rel, bool ownedByMaster);
00171
00172 TableSchema *m_tableSchema;
00173
00178 Relationship::List m_master_owned_rels;
00179
00181 Relationship::List m_master_rels;
00182
00184 Relationship::List m_details_rels;
00185
00186 bool m_primary : 1;
00187 bool m_unique : 1;
00188 bool m_isAutoGenerated : 1;
00189 bool m_isForeignKey : 1;
00190
00191 friend class Connection;
00192 friend class TableSchema;
00193 friend class QuerySchema;
00194 friend class Relationship;
00195 };
00196
00197 }
00198
00199 #endif
|