20#include <kexidb/indexschema.h>
22#include <kexidb/driver.h>
23#include <kexidb/connection.h>
24#include <kexidb/tableschema.h>
35 , m_tableSchema(tableSchema)
38 , m_isAutoGenerated( false )
39 , m_isForeignKey( false )
48 , m_tableSchema(&parentTable)
49 , m_primary( idx.m_primary )
50 , m_unique( idx.m_unique )
51 , m_isAutoGenerated( idx.m_isAutoGenerated )
52 , m_isForeignKey( idx.m_isForeignKey )
58 Field *parentTableField = parentTable. field( f_it.current()->name() );
59 if (!parentTableField) {
60 KexiDBWarn << "IndexSchema::IndexSchema(const IndexSchema& idx, const TableSchema& parentTable): "
61 "cannot find field '" << f_it.current()->name() << " in parentTable. Empty index will be created!" << endl;
83 for (;it.current();++it) {
84 if (it.current()->detailsIndex()) {
85 it.current()->detailsIndex()->detachRelationship(it.current());
93 if (field-> table() != m_tableSchema) {
94 KexiDBDbg << "IndexSchema::addField(" << (field ? field->name() : 0)
95 << "): WARNING: field doas not belong to the same table '"
96 << (field && field-> table() ? field-> table()->name() : 0)
97 << "'as index!" << endl;
106 return m_tableSchema;
111 return m_isAutoGenerated;
116 m_isAutoGenerated = set;
145 m_isForeignKey = set;
146 if (m_isForeignKey) {
150 m_fields.first()->setForeignKey( true);
157 + (m_isForeignKey ? "FOREIGN KEY " : "")
158 + (m_isAutoGenerated ? "AUTOGENERATED " : "")
159 + (m_primary ? "PRIMARY " : "")
160 + ((!m_primary) && m_unique ? "UNIQUE " : "")
173 if (rel->masterIndex()== this) {
185 else if (rel->detailsIndex()== this) {
FieldList & addField(Field *field)
virtual TQString debugString()
TQPtrListIterator< Field > ListIterator iterator for list of fields
virtual TableSchema * table() const
Provides information about database index that can be created for a database table.
Relationship::List m_master_rels
void detachRelationship(Relationship *rel)
TableSchema * table() const
bool isPrimaryKey() const
Relationship::List m_master_owned_rels table on that index is built
void setForeignKey(bool set)
void setAutoGenerated(bool set)
bool isAutoGenerated() const
Relationship::List m_details_rels
IndexSchema(TableSchema *tableSchema)
virtual FieldList & addField(Field *field)
void setPrimaryKey(bool set)
void attachRelationship(Relationship *rel)
virtual TQString debugString()
virtual TQString schemaDataDebugString() const
High-level database connectivity library with database backend drivers.
|