Index: trunk/ippTools/src/warptool.c
===================================================================
--- trunk/ippTools/src/warptool.c	(revision 16170)
+++ trunk/ippTools/src/warptool.c	(revision 16242)
@@ -30,4 +30,5 @@
 #include "pxtools.h"
 #include "warptool.h"
+#include "pxwarp.h"
 
 static psS64 definerunMode(pxConfig *config);
@@ -46,5 +47,4 @@
 
 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile);
-static bool setwarpRunState(pxConfig *config, psS64 warp_id, const char *state);
 static bool isValidMode(pxConfig *config, const char *mode);
 bool warpCompletedRuns(pxConfig *config);
@@ -200,5 +200,5 @@
         return false;
     }
-    if (!setwarpRunState(config, warp_id, "run")) {
+    if (!pxwarpRunSetState(config, warp_id, "run")) {
         // rollback
         if (!psDBRollback(config->dbh)) {
@@ -227,5 +227,5 @@
     if (state) {
         // set detRun.state to state
-        return setwarpRunState(config, (psS64)atoll(warp_id), state);
+        return pxwarpRunSetState(config, (psS64)atoll(warp_id), state);
     }
 
@@ -999,31 +999,4 @@
 
 
-static bool setwarpRunState(pxConfig *config, psS64 warp_id, const char *state)
-{
-    PS_ASSERT_PTR_NON_NULL(state, false);
-
-    // check that state is a valid string value
-    if (!(
-            (strncmp(state, "run", 4) == 0)
-            || (strncmp(state, "stop", 5) == 0)
-            || (strncmp(state, "reg", 4) == 0)
-        )
-    ) {
-        psError(PS_ERR_UNKNOWN, false,
-                "invalid warpRun state: %s", state);
-        return false;
-    }
-
-    char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = %" PRId64;
-    if (!p_psDBRunQuery(config->dbh, query, state, warp_id)) {
-        psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for warp_id %" PRId64, warp_id);
-        return false;
-    }
-
-    return true;
-}
-
-
 static bool isValidMode(pxConfig *config, const char *mode)
 {
