mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
34 lines
640 B
C++
Executable File
34 lines
640 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();
|
|
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 = "");
|
|
|
|
private:
|
|
|
|
QSqlDatabase db_;
|
|
void upgrade();
|
|
int version() const;
|
|
mutable int version_;
|
|
QStringList sqlStringToLines(const QString& sql);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // DATABASE_H
|