Nut/src/database_p.h

76 lines
1.8 KiB
C
Raw Normal View History

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 DATABASE_P_H
#define DATABASE_P_H
#include "database.h"
#include "databasemodel.h"
#include "changelogtable.h"
#include <QDebug>
2017-02-01 18:01:21 +08:00
NUT_BEGIN_NAMESPACE
2016-05-12 14:08:58 +08:00
class DatabasePrivate
{
Database *q_ptr;
Q_DECLARE_PUBLIC(Database)
public:
DatabasePrivate(Database *parent);
bool open(bool updateDatabase);
2016-05-12 14:08:58 +08:00
bool updateDatabase();
void createChangeLogs();
2018-01-08 17:08:10 +08:00
bool putModelToDatabase();
2016-05-12 14:08:58 +08:00
DatabaseModel getLastScheema();
2017-05-28 23:08:59 +08:00
bool getCurrectScheema();
2016-05-12 14:08:58 +08:00
QSqlDatabase db;
QString hostName;
QString databaseName;
int port;
QString userName;
QString password;
QString connectionName;
QString driver;
SqlGeneratorBase *sqlGenertor;
DatabaseModel currentModel;
TableSet<ChangeLogTable> *changeLogs;
2017-02-01 18:01:21 +08:00
2017-05-28 23:08:59 +08:00
QT_DEPRECATED
QHash<QString, QString> tables;
static QMap<QString, DatabaseModel> allTableMaps;
2018-01-08 17:08:10 +08:00
static qulonglong lastId;
2017-09-10 22:18:20 +08:00
QSet<TableSetBase *> tableSets;
2018-01-08 17:08:10 +08:00
bool isDatabaseNew;
2016-05-12 14:08:58 +08:00
};
2017-02-01 18:01:21 +08:00
NUT_END_NAMESPACE
2016-06-05 20:22:26 +08:00
2016-05-12 14:08:58 +08:00
#endif // DATABASE_P_H