2016-05-12 14:08:58 +08:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Nut project.
|
|
|
|
|
** https://github.com/HamedMasafi/Nut
|
|
|
|
|
**
|
|
|
|
|
** Nut is free software: you can redistribute it and/or modify
|
|
|
|
|
** it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
** (at your option) any later version.
|
|
|
|
|
**
|
|
|
|
|
** Nut is distributed in the hope that it will be useful,
|
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
** GNU Lesser General Public License for more details.
|
|
|
|
|
**
|
|
|
|
|
** You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
** along with Nut. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TABLESETBASE_H
|
|
|
|
|
#define TABLESETBASE_H
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
|
#include <QtCore/QSet>
|
|
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
2017-02-01 18:01:21 +08:00
|
|
|
NUT_BEGIN_NAMESPACE
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
class Table;
|
|
|
|
|
class Database;
|
|
|
|
|
class TableSetBase : public QObject
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
2018-02-26 18:14:36 +08:00
|
|
|
explicit TableSetBase(Database *parent);
|
|
|
|
|
explicit TableSetBase(Table *parent);
|
2016-05-12 14:08:58 +08:00
|
|
|
|
2017-09-10 22:18:20 +08:00
|
|
|
virtual int save(Database *db, bool cleanUp = false);
|
2016-05-21 16:09:03 +08:00
|
|
|
void clearChilds();
|
2016-05-12 14:08:58 +08:00
|
|
|
QString childClassName() const;
|
|
|
|
|
|
2016-05-21 16:09:03 +08:00
|
|
|
Database *database() const;
|
|
|
|
|
void setDatabase(Database *database);
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
protected:
|
|
|
|
|
QSet<Table*> _tables;
|
2016-05-21 16:09:03 +08:00
|
|
|
QList<Table*> _tablesList;
|
2016-05-12 14:08:58 +08:00
|
|
|
Database *_database;
|
|
|
|
|
Table *_table;
|
2019-02-07 23:52:57 +08:00
|
|
|
QString _tableName;
|
2016-05-12 14:08:58 +08:00
|
|
|
QString _childClassName;
|
2018-01-10 06:08:19 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void add(Table* t);
|
2019-03-07 23:35:57 +08:00
|
|
|
void remove(Table* t);
|
2018-01-10 06:08:19 +08:00
|
|
|
|
|
|
|
|
friend class Table;
|
|
|
|
|
friend class QueryBase;
|
2016-05-12 14:08:58 +08:00
|
|
|
};
|
|
|
|
|
|
2017-02-01 18:01:21 +08:00
|
|
|
NUT_END_NAMESPACE
|
|
|
|
|
|
2016-05-12 14:08:58 +08:00
|
|
|
#endif // TABLESETBASE_H
|