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
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
00160 LookupFieldSchema *lookupFieldSchema( const Field& field ) const;
00161
00163 LookupFieldSchema *lookupFieldSchema( const QString& fieldName );
00164
00167 const QPtrVector<LookupFieldSchema>& lookupFieldsList();
00168
00169 protected:
00171 TableSchema(Connection *conn, const QString & name = QString::null);
00172
00173 IndexSchema::List m_indices;
00174
00175 QGuardedPtr<Connection> m_conn;
00176
00177 IndexSchema *m_pkey;
00178
00179 QuerySchema *m_query;
00180
00181 class Private;
00182 Private *d;
00183
00184 private:
00186 void init();
00187
00189 void init(const TableSchema& ts, bool copyId);
00190
00191 bool m_isKexiDBSystem : 1;
00192
00193 friend class Connection;
00194 };
00195
00200 class KEXI_DB_EXPORT InternalTableSchema : public TableSchema
00201 {
00202 public:
00203 InternalTableSchema(const QString& name);
00204 InternalTableSchema(const TableSchema& ts);
00205 virtual ~InternalTableSchema();
00206 };
00207
00208 }
00209
00210 #endif
|