1 (* Implement 'retire' subcommand. *)
10 let cmd_retire dbh anon_params =
12 match anon_params with
13 | [] -> error "give a list of IDs (#ID) to retire"
14 | ids -> List.map Int32.of_string ids in
16 PGOCaml.begin_work dbh;
18 (* It's an error to retire a task which is already retired. *)
21 let rows = PGSQL(dbh) "select 1 from retired where taskid = $taskid" in
22 if rows = [Some 1_l] then
23 error "task %ld is already retired" taskid;
26 (* Drop the tasks from every other table. *)
27 PGSQL(dbh) "delete from imminent where taskid in $@ids";
28 PGSQL(dbh) "delete from todo where taskid in $@ids";
29 PGSQL(dbh) "delete from ideas where taskid in $@ids";
31 (* Add them to the retired table. *)
34 PGSQL(dbh) "insert into retired (taskid) values ($taskid)"