diff mbox

[OSSTEST,3/7] Database locking: Tcl: Use db-execute

Message ID 1452195496-16016-4-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson Jan. 7, 2016, 7:38 p.m. UTC
Replace open-coded uses of pg_execute dbh STMT with
jobdb::db-execute-array 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>
---
 ms-ownerdaemon |    6 +++---
 ms-queuedaemon |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Ian Campbell Jan. 8, 2016, 9:28 a.m. UTC | #1
On Thu, 2016-01-07 at 19:38 +0000, Ian Jackson wrote:
> Replace open-coded uses of pg_execute dbh STMT with
> jobdb::db-execute-array STMT.

ITYM jobdb::db-execute?
Ian Jackson Jan. 12, 2016, 3:38 p.m. UTC | #2
Ian Campbell writes ("Re: [OSSTEST PATCH 3/7] Database locking: Tcl: Use db-execute"):
> On Thu, 2016-01-07 at 19:38 +0000, Ian Jackson wrote:
> > Replace open-coded uses of pg_execute dbh STMT with
> > jobdb::db-execute-array STMT.
> 
> ITYM jobdb::db-execute?

Yes, fixed, thanks.

Ian.
diff mbox

Patch

diff --git a/ms-ownerdaemon b/ms-ownerdaemon
index a228e3c..502dcfe 100755
--- a/ms-ownerdaemon
+++ b/ms-ownerdaemon
@@ -32,7 +32,7 @@  proc chan-destroy-stuff {chan} {
     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
@@ -62,7 +62,7 @@  proc cmd/create-task {chan desc} {
         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')
@@ -93,7 +93,7 @@  main-daemon Owner {
     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'
diff --git a/ms-queuedaemon b/ms-queuedaemon
index b3a05ee..9325d46 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -155,7 +155,7 @@  proc runneeded-perhaps-start {} {
     }
 
     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')
@@ -167,7 +167,7 @@  proc runneeded-perhaps-start {} {
     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'
@@ -650,7 +650,7 @@  proc cmd/uptime {chan desc seconds} {
                 continue
             }
             if {$refinfo > $before} continue
-            pg_execute dbh "
+            jobdb::db-execute "
                 UPDATE tasks
                    SET live = false,
                        refinfo = refinfo || ' stale'