]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
Database locking: Tcl: Use db-execute-array
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 15 Dec 2015 16:05:29 +0000 (16:05 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 14 Jul 2016 12:03:34 +0000 (13:03 +0100)
Replace open-coded uses of pg_execute -array ARRAYVAR dbh STMT
with jobdb::db-execute-array ARRAYVAR 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-array 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>
ms-ownerdaemon
ms-queuedaemon

index 5b5233918a97e1a724761bd8e4a7f1c0464dfee4..cc2f36152413fba0c2b4ea9c1c09cd12ec53b8cc 100755 (executable)
@@ -67,7 +67,7 @@ proc cmd/create-task {chan desc} {
                         ( type,  refkey,               refinfo,         live)
                  VALUES ('ownd', [pg_quote $taskdesc], [clock seconds], 't')
         "
-        set nrows [pg_execute -array av dbh "
+        set nrows [jobdb::db-execute-array av "
             SELECT taskid
               FROM tasks
              WHERE live AND refkey = [pg_quote $taskdesc]
index 8affacc35ae907c9aa94318caffede0be1386b27..6e932880c113e15d040dda73cf8097104bd4519a 100755 (executable)
@@ -444,7 +444,7 @@ proc cmd/unwait {chan desc} {
 
 proc for-free-resources {varname body} {
     jobdb::transaction resources {
-       pg_execute -array free_resources_row dbh {
+       jobdb::db-execute-array free_resources_row {
                SELECT (restype || '/' || resname || '/' || shareix) AS r
                  FROM resources
             WHERE NOT (SELECT live FROM tasks WHERE taskid=owntaskid)
@@ -636,7 +636,7 @@ proc cmd/uptime {chan desc seconds} {
     set descpat "[regsub {\:\d+$} $desc {:%}]"
     transaction resources {
         set keys {}
-        pg_execute -array task dbh "
+        jobdb::db-execute-array task "
             SELECT * FROM tasks
                     WHERE type = 'ownd'
                       AND ( refkey LIKE [pg_quote $descpat]