Replace open-coded uses of pg_execute dbh STMT with
jobdb::db-execute STMT.
The only functional change is that if OSSTEST_TCL_JOBDB_DEBUG is set,
there will be debugging output.
But we are going to want to make db-execute do something more
complicated involving pg_exec.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
jobdb::transaction resources {
puts-chan-desc $chan "-- $tasks"
foreach task $tasks {
- pg_execute dbh "
+ jobdb::db-execute "
UPDATE tasks
SET live = 'f'
WHERE taskid = $task
set taskdesc $desc
}
jobdb::transaction resources {
- pg_execute dbh "
+ jobdb::db-execute "
INSERT INTO tasks
( type, refkey, refinfo, live)
VALUES ('ownd', [pg_quote $taskdesc], [clock seconds], 't')
jobdb::db-open
jobdb::transaction resources {
- set nrows [pg_execute dbh "
+ set nrows [jobdb::db-execute "
UPDATE tasks
SET refkey = 'previous ' || refkey
WHERE type = 'ownd'
}
jobdb::transaction resources {
- set nrows [pg_execute dbh {
+ set nrows [jobdb::db-execute {
UPDATE resources
SET owntaskid= (SELECT taskid FROM tasks
WHERE type='magic' AND refkey='allocatable')
if {!($nrows || $needed>=2)} return
jobdb::transaction resources {
- set cleaned [pg_execute dbh {
+ set cleaned [jobdb::db-execute {
DELETE FROM tasks
WHERE type='ownd'
AND live='f'
continue
}
if {$refinfo > $before} continue
- pg_execute dbh "
+ jobdb::db-execute "
UPDATE tasks
SET live = false,
refinfo = refinfo || ' stale'