Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 11bbe9a6

Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt

  • ID 11bbe9a6120fc2e5c135f9ecb89d15cc0cd24a52
  • Vorgänger d84c91e7
  • Nachfolger 3820ae33

cache stuff

Unterschiede anzeigen:

src/database.cpp
bool Database::transaction(const QString &query) {
bool rc = false;
if (supportTransactions) {
this->database.transaction();
this->startTransaction();
QSqlQuery sqlquery = QSqlQuery(this->database);
sqlquery.exec(query);
if (!this->database.commit()) {
this->database.rollback();
}
this->commitTransaction();
} else {
rc = this->exec(query);
}
......
for (int var = 0; var < queries.size(); ++var) {
sqlquery.exec(queries.at(var));
}
if (!this->database.commit()) {
this->database.rollback();
} else {
ok = true;
}
ok = this->commitTransaction();
} else {
ok = this->exec(queries);
}
......
}
bool Database::transaction(QSqlQuery &query) {
this->database.transaction();
this->startTransaction();
query.exec();
this->debugQuery(query);
if (!this->database.commit()) {
this->database.rollback();
return false;
}
return true;
return this->commitTransaction();
}
bool Database::transaction(QList<QSqlQuery> &queries) {
this->database.transaction();
this->startTransaction();
QSqlQuery q;
for (int var = 0; var < queries.size(); ++var) {
q = queries.at(var);
q.exec();
this->debugQuery(q);
}
if (!this->database.commit()) {
return this->commitTransaction();
}
bool Database::commitTransaction() {
if (this->supportTransactions && !this->database.commit()) {
this->database.rollback();
return false;
}
......
}
bool Database::exec(const QString &query) {
this->database.transaction();
QSqlQuery q = QSqlQuery(this->database);
q.exec(query);
bool ok = q.exec(query);
this->debugQuery(q);
if (!this->database.commit()) {
this->database.rollback();
return false;
}
return true;
return ok;
}
bool Database::exec(QStringList queries) {
......
return q;
}
void Database::startTransaction() {
this->database.transaction();
}
QSqlDatabase Database::getDatabase() {
return this->database;
}

Auch abrufbar als: Unified diff