1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-23 11:52:59 +02:00

34 lines
640 B
C
Raw Normal View History

2016-12-10 22:39:53 +00:00
#ifndef DATABASE_H
#define DATABASE_H
#include <stable.h>
2016-12-29 21:45:38 +01:00
#include "simpletypes.h"
2016-12-10 22:39:53 +00:00
namespace jop {
class Database {
public:
2016-12-29 21:45:38 +01:00
enum QueryType { Select, Insert, Update, Delete };
2016-12-10 22:39:53 +00:00
Database(const QString& path);
Database();
QSqlQuery query(const QString& sql) const;
2016-12-29 20:19:00 +01:00
QSqlDatabase& database();
2016-12-29 21:45:38 +01:00
QSqlQuery buildSqlQuery(Database::QueryType type, const QString& tableName, const QStringList& fields, const VariantVector& values, const QString& whereCondition = "");
2016-12-10 22:39:53 +00:00
private:
QSqlDatabase db_;
void upgrade();
int version() const;
mutable int version_;
2016-12-18 21:44:45 +00:00
QStringList sqlStringToLines(const QString& sql);
2016-12-10 22:39:53 +00:00
};
}
#endif // DATABASE_H