Changeset View
Changeset View
Standalone View
Standalone View
src/KDbTableSchema.h
Show All 23 Lines | |||||
24 | #include <QString> | 24 | #include <QString> | ||
25 | #include <QVector> | 25 | #include <QVector> | ||
26 | 26 | | |||
27 | #include "KDbFieldList.h" | 27 | #include "KDbFieldList.h" | ||
28 | #include "KDbIndexSchema.h" | 28 | #include "KDbIndexSchema.h" | ||
29 | 29 | | |||
30 | class KDbConnection; | 30 | class KDbConnection; | ||
31 | class KDbLookupFieldSchema; | 31 | class KDbLookupFieldSchema; | ||
32 | class KDbFieldPrivate; | ||||
32 | 33 | | |||
33 | /*! Provides information about native database table | 34 | /*! Provides information about native database table | ||
34 | that can be stored using KDb database engine. | 35 | that can be stored using KDb database engine. | ||
35 | */ | 36 | */ | ||
36 | class KDB_EXPORT KDbTableSchema : public KDbFieldList, public KDbObject | 37 | class KDB_EXPORT KDbTableSchema : public KDbFieldList, public KDbObject | ||
37 | { | 38 | { | ||
38 | public: | 39 | public: | ||
39 | explicit KDbTableSchema(const QString& name); | 40 | explicit KDbTableSchema(const QString& name); | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | |||||
123 | 124 | | |||
124 | /*! Removes all fields from the list, clears name and all other properties. | 125 | /*! Removes all fields from the list, clears name and all other properties. | ||
125 | @see KDbFieldList::clear() */ | 126 | @see KDbFieldList::clear() */ | ||
126 | void clear() override; | 127 | void clear() override; | ||
127 | 128 | | |||
128 | /*! Sends information about fields of this table schema to debug output @a dbg. */ | 129 | /*! Sends information about fields of this table schema to debug output @a dbg. */ | ||
129 | QDebug debugFields(QDebug dbg) const; | 130 | QDebug debugFields(QDebug dbg) const; | ||
130 | 131 | | |||
131 | /*! @return connection object if table was created/retrieved using a connection, | | |||
132 | otherwise 0. */ | | |||
133 | KDbConnection* connection() const; | | |||
134 | | ||||
135 | /*! @return true if this is internal KDb's table. | 132 | /*! @return true if this is internal KDb's table. | ||
136 | Internal tables are hidden in applications (if desired) but are available | 133 | Internal tables are hidden in applications (if desired) but are available | ||
137 | for schema export/import functionality. | 134 | for schema export/import functionality. | ||
138 | 135 | | |||
139 | Any internal KDb system table's schema (kexi__*) has | 136 | Any internal KDb system table's schema (kexi__*) has | ||
140 | cleared its KDbObject part, e.g. id=-1 for such table, | 137 | cleared its KDbObject part, e.g. id=-1 for such table, | ||
141 | and no description, caption and so on. This is because | 138 | and no description, caption and so on. This is because | ||
142 | it represents a native database table rather that extended Kexi table. | 139 | it represents a native database table rather that extended Kexi table. | ||
Show All 34 Lines | |||||
177 | /*! @return list of lookup field schemas for this table. | 174 | /*! @return list of lookup field schemas for this table. | ||
178 | The order is the same as the order of fields within the table. */ | 175 | The order is the same as the order of fields within the table. */ | ||
179 | QVector<KDbLookupFieldSchema*> lookupFields() const; | 176 | QVector<KDbLookupFieldSchema*> lookupFields() const; | ||
180 | 177 | | |||
181 | protected: | 178 | protected: | ||
182 | /*! Automatically retrieves table schema via connection. */ | 179 | /*! Automatically retrieves table schema via connection. */ | ||
183 | explicit KDbTableSchema(KDbConnection *conn, const QString & name = QString()); | 180 | explicit KDbTableSchema(KDbConnection *conn, const QString & name = QString()); | ||
184 | 181 | | |||
182 | /*! @return connection object if table was created/retrieved using a connection, | ||||
183 | otherwise @c nullptr. */ | ||||
184 | KDbConnection* connection() const; | ||||
185 | | ||||
185 | /*! For KDbConnection. */ | 186 | /*! For KDbConnection. */ | ||
186 | void setConnection(KDbConnection* conn); | 187 | void setConnection(KDbConnection* conn); | ||
187 | 188 | | |||
188 | private: | 189 | private: | ||
189 | //! Used by some ctors. | 190 | //! Used by some ctors. | ||
190 | void init(KDbConnection* conn); | 191 | void init(KDbConnection* conn); | ||
191 | 192 | | |||
192 | //! Used by some ctors. | 193 | //! Used by some ctors. | ||
193 | void init(const KDbTableSchema& ts, bool copyId); | 194 | void init(const KDbTableSchema& ts, bool copyId); | ||
194 | 195 | | |||
195 | class Private; | 196 | class Private; | ||
196 | Private * const d; | 197 | Private * const d; | ||
197 | 198 | | |||
198 | friend class KDbConnection; | 199 | friend class KDbConnection; | ||
199 | friend class KDbNativeStatementBuilder; | 200 | friend class KDbNativeStatementBuilder; | ||
201 | friend class KDbFieldPrivate; | ||||
200 | Q_DISABLE_COPY(KDbTableSchema) | 202 | Q_DISABLE_COPY(KDbTableSchema) | ||
201 | }; | 203 | }; | ||
202 | 204 | | |||
203 | /*! Internal table with a name @a name. Rarely used. | 205 | /*! Internal table with a name @a name. Rarely used. | ||
204 | Use KDbConnection::createTable() to create a table using this schema. | 206 | Use KDbConnection::createTable() to create a table using this schema. | ||
205 | The table will not be visible as user table. | 207 | The table will not be visible as user table. | ||
206 | For example, 'kexi__blobs' table is created this way by Kexi application. */ | 208 | For example, 'kexi__blobs' table is created this way by Kexi application. */ | ||
207 | class KDB_EXPORT KDbInternalTableSchema : public KDbTableSchema | 209 | class KDB_EXPORT KDbInternalTableSchema : public KDbTableSchema | ||
Show All 19 Lines |