diff options
Diffstat (limited to 'captain/db.f90')
-rw-r--r-- | captain/db.f90 | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/captain/db.f90 b/captain/db.f90 index fa53774..a661fd4 100644 --- a/captain/db.f90 +++ b/captain/db.f90 @@ -589,12 +589,15 @@ contains implicit none integer, intent(in)::job_id - character(8)::update_date - character(10)::update_time + character(10)::update_date + character(8)::update_time + integer, dimension(8)::values type(sqlite3_stmt)::stmt - call date_and_time(date=update_date, time=update_time) + call date_and_time(values=values) + write(update_date, '(I4,A1,I0.2,A1,I0.2)') values(1), "-", values(2), "-", values(3) + write(update_time, '(I2,A1,I0.2,A1,I0.2)') values(5), ":", values(6), ":", values(7) if(stmt%prepare(db, "UPDATE jobs SET time=? WHERE id=?") == SQLITE_OK) then if(stmt%bind_text(1, update_date//" "//update_time) == SQLITE_OK .and. & stmt%bind_int(2, job_id) == SQLITE_OK) then @@ -697,6 +700,25 @@ contains end function get_pending_job_for_player + subroutine mark_working_jobs_as_failed(player) + implicit none + + integer, intent(in)::player + type(sqlite3_stmt)::stmt + + if(stmt%prepare(db, "UPDATE jobs SET status=? WHERE player=? AND status=? LIMIT 1") == SQLITE_OK) then + if(stmt%bind_int(1, JOB_STATUS_FAILURE) == SQLITE_OK .and. & + stmt%bind_int(2, player) == SQLITE_OK .and. & + stmt%bind_int(3, JOB_STATUS_WORKING) == SQLITE_OK) then + + call stmt%step_now() + + end if + end if + call stmt%finalize() + + end subroutine mark_working_jobs_as_failed + subroutine scan_instructions_for_db() use config use utilities |