kexi
tableschema.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIDB_TABLE_H
00022 #define KEXIDB_TABLE_H
00023
00024 #include <qvaluelist.h>
00025 #include <qptrlist.h>
00026 #include <qstring.h>
00027 #include <qguardedptr.h>
00028
00029 #include <kexidb/fieldlist.h>
00030 #include <kexidb/schemadata.h>
00031 #include <kexidb/indexschema.h>
00032 #include <kexidb/relationship.h>
00033
00034 namespace KexiDB {
00035
00036 class Connection;
00037 class LookupFieldSchema;
00038
00043 class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData
00044 {
00045 public:
00046 typedef QPtrList<TableSchema> List;
00047 typedef QPtrListIterator<TableSchema> ListIterator;
00048
00049 TableSchema(const QString & name);
00050 TableSchema(const SchemaData& sdata);
00051 TableSchema();
00052
00056 TableSchema(const TableSchema& ts, bool copyId = true);
00057
00058 virtual ~TableSchema();
00059
00062 virtual FieldList& insertField(uint index, Field *field);
00063
00065 virtual void removeField(KexiDB::Field *field);
00066
00071 IndexSchema* primaryKey() const { return m_pkey; }
00072
00083 void setPrimaryKey(IndexSchema *pkey);
00084
00085 const IndexSchema::ListIterator indicesIterator() const
00086 { return IndexSchema::ListIterator(m_indices); }
00087
00088 const IndexSchema::List* indices() { return &m_indices; }
00089
00092 virtual void clear();
00093
00097 QString debugString(bool includeTableName);
00098
00100 virtual QString debugString();
00101
00104 Connection* connection() const { return m_conn; }
00105
00120 bool isKexiDBSystem() const { return m_isKexiDBSystem; }
00121
00125 void setKexiDBSystem(bool set);
00126
00129 virtual bool isNative() const { return m_native || m_isKexiDBSystem; }
00130
00131
00132 virtual void setNative(bool set);
00133
00138 QuerySchema* query();
00139
00142 Field* anyNonPKField();
00143
00148 bool setLookupFieldSchema( const QString& fieldName, LookupFieldSchema *lookupFieldSchema );
00149
00152 LookupFieldSchema *lookupFieldSchema( const Field& field ) const;
00153
00155 LookupFieldSchema *lookupFieldSchema( const QString& fieldName );
00156
00157 protected:
00159 TableSchema(Connection *conn, const QString & name = QString::null);
00160
00161 void init();
00162
00163 IndexSchema::List m_indices;
00164
00165 QGuardedPtr<Connection> m_conn;
00166
00167 IndexSchema *m_pkey;
00168
00169 QuerySchema *m_query;
00170
00171 class Private;
00172 Private *d;
00173
00174 private:
00175 bool m_isKexiDBSystem : 1;
00176
00177 friend class Connection;
00178 };
00179
00184 class KEXI_DB_EXPORT InternalTableSchema : public TableSchema
00185 {
00186 public:
00187 InternalTableSchema(const QString& name);
00188 virtual ~InternalTableSchema();
00189 };
00190
00191 }
00192
00193 #endif
|