diff options
Diffstat (limited to 'captain/db.f90')
-rw-r--r-- | captain/db.f90 | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/captain/db.f90 b/captain/db.f90 index 7937383..7bc501d 100644 --- a/captain/db.f90 +++ b/captain/db.f90 @@ -608,13 +608,32 @@ contains end subroutine update_job_time + subroutine insert_task(job_id, task_id) + implicit none + + integer, intent(in)::job_id, task_id + type(sqlite3_stmt)::stmt + + if(stmt%prepare(db, "INSERT INTO tasks(job, task, status) VALUES(?,?,?") == SQLITE_OK) then + if(stmt%bind_int(1, job_id) == SQLITE_OK .and. & + stmt%bind_int(2, task_id) == SQLITE_OK .and. & + stmt%bind_int(3, JOB_STATUS_WORKING) == SQLITE_OK) then + call stmt%step_now() + end if + end if + call stmt%finalize() + + call update_job_time(job_id) + + end subroutine insert_task + subroutine update_task_status(job_id, task_id, status) implicit none integer, intent(in)::job_id, task_id, status type(sqlite3_stmt)::stmt - if(stmt%prepare(db, "UPDATE jobs SET status=? WHERE job=? AND task=?") == SQLITE_OK) then + if(stmt%prepare(db, "UPDATE tasks SET status=? WHERE job=? AND task=?") == SQLITE_OK) then if(stmt%bind_int(1, status) == SQLITE_OK .and. & stmt%bind_int(2, job_id) == SQLITE_OK .and. & stmt%bind_int(3, task_id) == SQLITE_OK) then |