tableschema.h
Go to the documentation of this file.00001
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
00042 class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData
00043 {
00044 public:
00045 typedef QPtrList<TableSchema> List;
00046 typedef QPtrListIterator<TableSchema> ListIterator;
00047
00048 TableSchema(const QString & name);
00049 TableSchema(const SchemaData& sdata);
00050 TableSchema();
00051
00055 TableSchema(const TableSchema& ts, bool copyId = true);
00056
00061 TableSchema(const TableSchema& ts, int setId);
00062
00063 virtual ~TableSchema();
00064
00067 virtual FieldList& insertField(uint index, Field *field);
00068
00070 virtual void removeField(KexiDB::Field *field);
00071
00076 IndexSchema* primaryKey() const { return m_pkey; }
00077
00088 void setPrimaryKey(IndexSchema *pkey);
00089
00090 const IndexSchema::ListIterator indicesIterator() const
00091 { return IndexSchema::ListIterator(m_indices); }
00092
00093 const IndexSchema::List* indices() { return &m_indices; }
00094
00097 virtual void clear();
00098
00102 QString debugString(bool includeTableName);
00103
00105 virtual QString debugString();
00106
00109 Connection* connection() const { return m_conn; }
00110
00125 bool isKexiDBSystem() const { return m_isKexiDBSystem; }
00126
00130 void setKexiDBSystem(bool set);
00131
00134 virtual bool isNative() const { return m_native || m_isKexiDBSystem; }
00135
00136
00137 virtual void setNative(bool set);
00138
00143 QuerySchema* query();
00144
00147 Field* anyNonPKField();
00148
00153 bool setLookupFieldSchema( const QString& fieldName, LookupFieldSchema *lookupFieldSchema );
00154
00157 LookupFieldSchema *lookupFieldSchema( const Field& field ) const;
00158
00160 LookupFieldSchema *lookupFieldSchema( const QString& fieldName );
00161
00164 const QPtrVector<LookupFieldSchema>& lookupFieldsList();
00165
00166 protected:
00168 TableSchema(Connection *conn, const QString & name = QString::null);
00169
00170 IndexSchema::List m_indices;
00171
00172 QGuardedPtr<Connection> m_conn;
00173
00174 IndexSchema *m_pkey;
00175
00176 QuerySchema *m_query;
00177
00178 class Private;
00179 Private *d;
00180
00181 private:
00183 void init();
00184
00186 void init(const TableSchema& ts, bool copyId);
00187
00188 bool m_isKexiDBSystem : 1;
00189
00190 friend class Connection;
00191 };
00192
00197 class KEXI_DB_EXPORT InternalTableSchema : public TableSchema
00198 {
00199 public:
00200 InternalTableSchema(const QString& name);
00201 InternalTableSchema(const TableSchema& ts);
00202 virtual ~InternalTableSchema();
00203 };
00204
00205 }
00206
00207 #endif
This file is part of the documentation for Kexi 2.0 alpha.