Revision f89ad1ad
Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt
samples/example/main.cpp | ||
---|---|---|
// CuteEntityManager::EntityManager("QSQLITE",
|
||
// QDir::currentPath() + "/db.sqlite", "", "", "", 0, true);
|
||
CuteEntityManager::EntityManager("QSQLITE",
|
||
":memory:");
|
||
":memory:","","","","",true);
|
||
SqliteBackupProcessor *sqliteproc = new SqliteBackupProcessor(e->getDb(),
|
||
QDir::currentPath());
|
||
qWarning() << "DB Loaded:" << sqliteproc->sqliteDBMemFile(false, "db.sqlite");
|
src/queryinterpreter.cpp | ||
---|---|---|
} else {
|
||
clause += ", ";
|
||
}
|
||
clause += from.at(var);
|
||
clause += tables.at(var);
|
||
}
|
||
return clause;
|
||
}
|
src/sqlitebackupprocessor.cpp | ||
---|---|---|
}
|
||
|
||
SqliteBackupProcessor::SqliteBackupProcessor(QSharedPointer<Database> database,
|
||
QString destination, QString backupFilename, QTimer timer,
|
||
QString destination, QString backupFilename, QSharedPointer<QTimer> timer,
|
||
bool incrementalBackups, int backupCount) {
|
||
this->database = database;
|
||
this->destination = destination;
|
||
... | ... | |
this->backupFilename = backupFilename;
|
||
this->incrementalBackups = incrementalBackups;
|
||
this->backupCount = backupCount;
|
||
connect(timer, &QTimer::timeout, this,
|
||
connect(timer.data(), &QTimer::timeout, this,
|
||
&SqliteBackupProcessor::backup);
|
||
}
|
||
|
||
... | ... | |
this->sqliteDBMemFile(true, fileName);
|
||
}
|
||
|
||
QSharedPointer<QTimer> SqliteBackupProcessor::getTimer() const {
|
||
return timer;
|
||
}
|
||
|
||
void SqliteBackupProcessor::setTimer(const QSharedPointer<QTimer> &value) {
|
||
timer = value;
|
||
}
|
||
|
||
|
||
bool SqliteBackupProcessor::getIncrementalBackups() const {
|
||
return incrementalBackups;
|
||
}
|
||
... | ... | |
backupCount = value;
|
||
}
|
||
|
||
|
||
QTimer SqliteBackupProcessor::getTimer() const {
|
||
return timer;
|
||
}
|
||
|
||
void SqliteBackupProcessor::setTimer(const QTimer &value) {
|
||
timer = value;
|
||
}
|
||
|
||
QString SqliteBackupProcessor::getBackupFilename() const {
|
||
return backupFilename;
|
||
}
|
src/sqlitebackupprocessor.h | ||
---|---|---|
explicit SqliteBackupProcessor(QSharedPointer<Database> database,
|
||
QString destination);
|
||
explicit SqliteBackupProcessor(QSharedPointer<Database> database,
|
||
QString destination, QString backupFilename, QTimer timer,
|
||
QString destination, QString backupFilename, QSharedPointer<QTimer> timer,
|
||
bool incrementalBackups = false, int backupCount = 1);
|
||
~SqliteBackupProcessor();
|
||
QSharedPointer<Database> getDatabase() const;
|
||
... | ... | |
QString getBackupFilename() const;
|
||
void setBackupFilename(const QString &value);
|
||
|
||
QTimer getTimer() const;
|
||
void setTimer(const QTimer &value);
|
||
|
||
int getBackupCount() const;
|
||
void setBackupCount(int value);
|
||
|
||
bool getIncrementalBackups() const;
|
||
void setIncrementalBackups(bool value);
|
||
|
||
public slots:
|
||
QSharedPointer<QTimer> getTimer() const;
|
||
void setTimer(const QSharedPointer<QTimer> &value);
|
||
|
||
public slots:
|
||
bool sqliteDBMemFile(bool save, QString fileName = "db.sqlite.bak");
|
||
void backup();
|
||
private:
|
||
QSharedPointer<Database> database;
|
||
QString destination;
|
||
QString backupFilename;
|
||
QTimer timer;
|
||
QSharedPointer<QTimer> timer;
|
||
bool incrementalBackups;
|
||
int backupCount;
|
||
int counter = 0;
|
Auch abrufbar als: Unified diff
fix