Compare commits
No commits in common. "296f37262daa6a3ebb5bf9b32701d26ec5315132" and "495912f0d271f0b5665180892855b57bb6590709" have entirely different histories.
296f37262d
...
495912f0d2
@ -1146,27 +1146,27 @@ std::string CiLogic::queue_pull_tarball(std::vector<std::shared_ptr<PackageConf>
|
||||
continue;
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> tarball_task = std::make_shared<Task>();
|
||||
task_queue->enqueue(
|
||||
job_statuses.at("pull"),
|
||||
[this, r, &task_queue, tarball_task, job_statuses](std::shared_ptr<Log> log) mutable {
|
||||
[this](std::shared_ptr<Log> log) mutable {
|
||||
std::shared_ptr<PackageConf> pkgconf = log->get_task_context()->get_parent_packageconf();
|
||||
if (pull_project(pkgconf, log)) {
|
||||
task_queue->enqueue(
|
||||
job_statuses.at("tarball"),
|
||||
[this, r](std::shared_ptr<Log> log) mutable {
|
||||
bool tarball_ok = create_project_tarball(r, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
tarball_task = r->get_task_by_jobstatus(job_statuses.at("tarball"));
|
||||
}
|
||||
bool pull_ok = pull_project(pkgconf, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
|
||||
new_item->first_pull_task = r->get_task_by_jobstatus(job_statuses.at("pull"));
|
||||
new_item->first_tarball_task = tarball_task;
|
||||
|
||||
task_queue->enqueue(
|
||||
job_statuses.at("tarball"),
|
||||
[this](std::shared_ptr<Log> log) mutable {
|
||||
std::shared_ptr<PackageConf> pkgconf = log->get_task_context()->get_parent_packageconf();
|
||||
bool tarball_ok = create_project_tarball(pkgconf, log);
|
||||
},
|
||||
r
|
||||
);
|
||||
|
||||
new_item->first_tarball_task = r->get_task_by_jobstatus(job_statuses.at("tarball"));
|
||||
new_item->first_pkgconf = r;
|
||||
|
||||
new_item->packaging_commit = r->packaging_commit;
|
||||
|
@ -56,13 +56,11 @@ QSqlDatabase get_thread_connection() {
|
||||
return thread_db;
|
||||
}
|
||||
|
||||
bool ci_query_exec(QSqlQuery* query, const QString query_string) {
|
||||
bool ci_query_exec(QSqlQuery* query) {
|
||||
bool passed = false;
|
||||
int attempt = 0;
|
||||
while (!passed) {
|
||||
if (query_string.isEmpty()) passed = query->exec();
|
||||
else passed = query->exec(query_string);
|
||||
|
||||
passed = query->exec();
|
||||
if (passed) return true;
|
||||
attempt++;
|
||||
|
||||
@ -81,9 +79,9 @@ bool init_database(const QString& database_path) {
|
||||
// Apply PRAGMAs
|
||||
{
|
||||
QSqlQuery pragma_query(get_thread_connection());
|
||||
ci_query_exec(&pragma_query, "PRAGMA journal_mode = WAL;");
|
||||
ci_query_exec(&pragma_query, "PRAGMA synchronous = NORMAL;");
|
||||
ci_query_exec(&pragma_query, "PRAGMA foreign_keys = ON;");
|
||||
pragma_query.exec("PRAGMA journal_mode = WAL;");
|
||||
pragma_query.exec("PRAGMA synchronous = NORMAL;");
|
||||
pragma_query.exec("PRAGMA foreign_keys = ON;");
|
||||
}
|
||||
|
||||
// Run the schema creation (or migration) statements
|
||||
@ -202,7 +200,7 @@ bool init_database(const QString& database_path) {
|
||||
for (const QString &statement : sql_statements) {
|
||||
QSqlQuery query(get_thread_connection());
|
||||
QString trimmed = statement.trimmed();
|
||||
if (!trimmed.isEmpty() && !ci_query_exec(&query, trimmed)) {
|
||||
if (!trimmed.isEmpty() && !query.exec(trimmed)) {
|
||||
qDebug() << "Failed to execute SQL: " << trimmed
|
||||
<< "\nError: " << query.lastError().text();
|
||||
return false;
|
||||
|
@ -18,10 +18,9 @@
|
||||
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#include <QString>
|
||||
|
||||
QSqlDatabase get_thread_connection();
|
||||
bool ci_query_exec(QSqlQuery* query, const QString query_string = "");
|
||||
bool ci_query_exec(QSqlQuery* query);
|
||||
bool init_database(const QString& database_path);
|
||||
|
||||
#endif // DB_COMMON_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user