mirror of
https://github.com/laurent22/joplin.git
synced 2025-04-14 11:18:47 +02:00
41 lines
769 B
C++
Executable File
41 lines
769 B
C++
Executable File
#ifndef DATABASE_H
|
|
#define DATABASE_H
|
|
|
|
#include <stable.h>
|
|
#include "simpletypes.h"
|
|
|
|
namespace jop {
|
|
|
|
class Database {
|
|
|
|
public:
|
|
|
|
enum QueryType { Select, Insert, Update, Delete };
|
|
|
|
Database(const QString& path);
|
|
Database();
|
|
void initialize(const QString& path);
|
|
QSqlQuery query(const QString& sql) const;
|
|
QSqlDatabase& database();
|
|
QSqlQuery buildSqlQuery(Database::QueryType type, const QString& tableName, const QStringList& fields, const VariantVector& values, const QString& whereCondition = "");
|
|
bool errorCheck(const QSqlQuery& query);
|
|
|
|
//Change newChange() const;
|
|
|
|
private:
|
|
|
|
QSqlDatabase db_;
|
|
void upgrade();
|
|
int version() const;
|
|
mutable int version_;
|
|
QStringList sqlStringToLines(const QString& sql);
|
|
|
|
};
|
|
|
|
|
|
Database& db();
|
|
|
|
}
|
|
|
|
#endif // DATABASE_H
|