Index: trunk/ippTools/src/warptool.c
===================================================================
--- trunk/ippTools/src/warptool.c	(revision 12004)
+++ trunk/ippTools/src/warptool.c	(revision 12024)
@@ -44,7 +44,7 @@
 
 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile);
-static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state);
+static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state);
 static bool isValidMode(pxConfig *config, const char *mode);
-bool p4CompletedRuns(pxConfig *config);
+bool warpCompletedRuns(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -145,5 +145,5 @@
     }
 
-    p4RunRow *p4Run = p4RunRowAlloc(
+    warpRunRow *warpRun = warpRunRowAlloc(
             0,          // ID
             mode,
@@ -154,16 +154,16 @@
     );
     psFree(registered);
-    if (!p4Run) {
-        psError(PS_ERR_UNKNOWN, false, "failed to alloc p4Run object");
+    if (!warpRun) {
+        psError(PS_ERR_UNKNOWN, false, "failed to alloc warpRun object");
         return true;
     }
-    if (!p4RunInsertObject(config->dbh, p4Run)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(p4Run);
+    if (!warpRunInsertObject(config->dbh, warpRun)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(warpRun);
         return true;
     }
 
-    // get the assigned p4_id
-    p4Run->p4_id = psDBLastInsertID(config->dbh);
+    // get the assigned warp_id
+    warpRun->warp_id = psDBLastInsertID(config->dbh);
 
     bool simple = false;
@@ -173,16 +173,16 @@
         if (!status) {
             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
-            psFree(p4Run);
-            return false;
-        }
-    }
-
-    if (!p4RunPrintObject(stdout, p4Run, !simple)) {
+            psFree(warpRun);
+            return false;
+        }
+    }
+
+    if (!warpRunPrintObject(stdout, warpRun, !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print object");
-            psFree(p4Run);
-            return false;
-    }
-
-    psFree(p4Run);
+            psFree(warpRun);
+            return false;
+    }
+
+    psFree(warpRun);
 
     return true;
@@ -195,11 +195,11 @@
 
     bool status = false;
-    psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4t_id");
-        return false;
-    }
-    if (!p4_id) {
-        psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
+    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warpt_id");
+        return false;
+    }
+    if (!warp_id) {
+        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
         return false;
     }
@@ -217,5 +217,5 @@
     if (state) {
         // set detRun.state to state
-        return setp4RunState(config, p4_id, state);
+        return setwarpRunState(config, warp_id, state);
     }
 
@@ -229,11 +229,11 @@
 
     bool status = false;
-    psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
-        return false;
-    }
-    if (!p4_id) {
-        psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
+    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
+        return false;
+    }
+    if (!warp_id) {
+        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
         return false;
     }
@@ -250,24 +250,24 @@
 
     // defaults to 0
-    psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
+    psS32 cam_version = psMetadataLookupS32(&status, config->args, "-cam_version");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version");
         return false;
     }
 
     // defaults to false
-    bool magiced = psMetadataLookupBool(&status, config->args, "-p3_version");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
-        return false;
-    }
-
-    // XXX need to validate the p4_id here
+    bool magiced = psMetadataLookupBool(&status, config->args, "-cam_version");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version");
+        return false;
+    }
+
+    // XXX need to validate the warp_id here
     // XXX instead of validiting it here we should just use forgein key
     // constrants
-    if (!p4InputExpInsert(config->dbh, 
-            (psS32)atoi(p4_id),
+    if (!warpInputExpInsert(config->dbh, 
+            (psS32)atoi(warp_id),
             exp_tag,
-            p3_version,
+            cam_version,
             magiced
         )) {
@@ -294,18 +294,18 @@
     psString query = psStringCopy( 
         "SELECT\n"
-        "   p3ProcessedExp.*\n"
-        " FROM p4Run\n"
-        " JOIN p4InputExp\n"
-        "   USING(p4_id)\n"
-        " JOIN p3ProcessedExp\n"
-        "   ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"
-        "   AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"
+        "   camProcessedExp.*\n"
+        " FROM warpRun\n"
+        " JOIN warpInputExp\n"
+        "   USING(warp_id)\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
+        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
-        "   AND p3ProcessedExp.fault = 0\n"
+        "   warpRun.state = 'run'\n" 
+        "   AND camProcessedExp.fault = 0\n"
     );
 
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -358,5 +358,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -386,14 +386,14 @@
         "SELECT\n"
         "   rawImfile.*\n"
-        " FROM p4Run\n"
-        " JOIN p4InputExp\n"
-        "   USING(p4_id)\n"
+        " FROM warpRun\n"
+        " JOIN warpInputExp\n"
+        "   USING(warp_id)\n"
         " JOIN rawImfile\n" // is there any reason not to refer back to rawimfiles?
-        "   ON p4InputExp.exp_tag = rawImfile.exp_tag\n"
+        "   ON warpInputExp.exp_tag = rawImfile.exp_tag\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
+        "   warpRun.state = 'run'\n" 
     );
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -446,5 +446,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4InputImfile", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -473,25 +473,25 @@
     psString query = psStringCopy( 
         "SELECT\n"
-        "   p3ProcessedExp.*\n"
-        " FROM p4Run\n"
-        " JOIN p4InputExp\n"
-        "   USING(p4_id)\n"
-        " JOIN p3ProcessedExp\n"
-        "   ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n"
-        "   AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n"
-        " LEFT JOIN p4SkyCellMap\n"
-        "   ON p4InputExp.p4_id = p4SkyCellMap.p4_id\n"
-        "   AND p4InputExp.exp_tag = p4SkyCellMap.exp_tag\n"
-        "   AND p4InputExp.p3_version = p4SkyCellMap.p3_version\n"
+        "   camProcessedExp.*\n"
+        " FROM warpRun\n"
+        " JOIN warpInputExp\n"
+        "   USING(warp_id)\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
+        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
+        " LEFT JOIN warpSkyCellMap\n"
+        "   ON warpInputExp.warp_id = warpSkyCellMap.warp_id\n"
+        "   AND warpInputExp.exp_tag = warpSkyCellMap.exp_tag\n"
+        "   AND warpInputExp.cam_version = warpSkyCellMap.cam_version\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
-        "   AND p3ProcessedExp.fault = 0\n"
-        "   AND p4SkyCellMap.p4_id IS NULL\n"
-        "   AND p4SkyCellMap.exp_tag IS NULL\n"
-        "   AND p4SkyCellMap.p3_version IS NULL\n"
+        "   warpRun.state = 'run'\n" 
+        "   AND camProcessedExp.fault = 0\n"
+        "   AND warpSkyCellMap.warp_id IS NULL\n"
+        "   AND warpSkyCellMap.exp_tag IS NULL\n"
+        "   AND warpSkyCellMap.cam_version IS NULL\n"
     );
 
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpInputExp");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -544,5 +544,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -623,7 +623,7 @@
         // this conversion isn't strictly nessicary but it's an easy way of
         // validating the format
-        p4SkyCellMapRow *row = p4SkyCellMapObjectFromMetadata(sc);
+        warpSkyCellMapRow *row = warpSkyCellMapObjectFromMetadata(sc);
         if (!row) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a p4SkyCellMap object", mapfile);
+            psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a warpSkyCellMap object", mapfile);
             psFree(iter);
             psFree(skycells);
@@ -631,5 +631,5 @@
         }
 
-        if (!p4SkyCellMapInsertObject(config->dbh, row)) {
+        if (!warpSkyCellMapInsertObject(config->dbh, row)) {
             psErrorCode err = psErrorCodeLast();
             switch (err) {
@@ -670,14 +670,14 @@
     psString query = psStringCopy( 
         "SELECT\n"
-        "   p4SkyCellMap.*\n"
-        " FROM p4Run\n"
-        " JOIN p4SkyCellMap\n"
-        "   USING(p4_id)\n"
+        "   warpSkyCellMap.*\n"
+        " FROM warpRun\n"
+        " JOIN warpSkyCellMap\n"
+        "   USING(warp_id)\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
+        "   warpRun.state = 'run'\n" 
     );
 
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4SkyCellMap");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -713,5 +713,5 @@
     }
     if (!psArrayLength(output)) {
-        psError(PS_ERR_UNKNOWN, false, "no p4SkyCellMap rows found");
+        psError(PS_ERR_UNKNOWN, false, "no warpSkyCellMap rows found");
         psFree(output);
         return true;
@@ -730,5 +730,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4SkyCellMap", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -757,19 +757,19 @@
     psString query = psStringCopy( 
         "SELECT\n"
-        "   p4SkyCellMap.*\n"
-        " FROM p4Run\n"
-        " JOIN p4SkyCellMap\n"
-        "   USING(p4_id)\n"
-        " LEFT JOIN p4Skyfile\n"
-        "   USING(p4_id, skycell_id, tess_id)\n"
+        "   warpSkyCellMap.*\n"
+        " FROM warpRun\n"
+        " JOIN warpSkyCellMap\n"
+        "   USING(warp_id)\n"
+        " LEFT JOIN warpSkyfile\n"
+        "   USING(warp_id, skycell_id, tess_id)\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
-        "   AND p4Skyfile.p4_id IS NULL\n"
-        "   AND p4Skyfile.skycell_id IS NULL\n"
-        "   AND p4Skyfile.tess_id IS NULL\n"
+        "   warpRun.state = 'run'\n" 
+        "   AND warpSkyfile.warp_id IS NULL\n"
+        "   AND warpSkyfile.skycell_id IS NULL\n"
+        "   AND warpSkyfile.tess_id IS NULL\n"
     );
 
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4SkyCellMap");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyCellMap");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -805,5 +805,5 @@
     }
     if (!psArrayLength(output)) {
-        psError(PS_ERR_UNKNOWN, false, "no p4PendingSkyCell rows found");
+        psError(PS_ERR_UNKNOWN, false, "no warpPendingSkyCell rows found");
         psFree(output);
         return true;
@@ -822,5 +822,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4PendingSkyCell", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -840,11 +840,11 @@
 
     bool status = false;
-    psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
-        return false;
-    }
-    if (!p4_id) {
-        psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
+    psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id");
+        return false;
+    }
+    if (!warp_id) {
+        psError(PS_ERR_UNKNOWN, true, "-warp_id is required");
         return false;
     }
@@ -900,7 +900,7 @@
     }
 
-    // XXX need to validate that this coresponds to an p4InputImfile
-    if (!p4SkyfileInsert(config->dbh, 
-            (psS32)atoi(p4_id),
+    // XXX need to validate that this coresponds to an warpInputImfile
+    if (!warpSkyfileInsert(config->dbh, 
+            (psS32)atoi(warp_id),
             skycell_id,
             tess_id,
@@ -916,5 +916,5 @@
     }
 
-    if (!p4CompletedRuns(config)) {
+    if (!warpCompletedRuns(config)) {
         if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "database error");
@@ -933,5 +933,5 @@
 }
 
-bool p4CompletedRuns(pxConfig *config)
+bool warpCompletedRuns(pxConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
@@ -945,26 +945,26 @@
     // modifying.
     char *query =
-        "UPDATE p4Run\n"
-        "   SET p4Run.state = 'stop'\n"
+        "UPDATE warpRun\n"
+        "   SET warpRun.state = 'stop'\n"
         " WHERE\n"
-        "   p4Run.p4_id =\n"
+        "   warpRun.warp_id =\n"
         "   (SELECT DISTINCT\n"
-        "       p4_id\n"
+        "       warp_id\n"
         "   FROM\n"
         "       (SELECT DISTINCT\n"
-        "           p4Run.p4_id,\n"
-        "           p4SkyCellMap.p4_id as foo,\n"
-        "           p4Skyfile.p4_id as bar\n"
-        "       FROM p4Run\n"
-        "       JOIN p4SkyCellMap\n"
-        "           USING(p4_id)\n"
-        "       LEFT JOIN p4Skyfile\n"
-        "           USING(p4_id, skycell_id, tess_id)\n"
+        "           warpRun.warp_id,\n"
+        "           warpSkyCellMap.warp_id as foo,\n"
+        "           warpSkyfile.warp_id as bar\n"
+        "       FROM warpRun\n"
+        "       JOIN warpSkyCellMap\n"
+        "           USING(warp_id)\n"
+        "       LEFT JOIN warpSkyfile\n"
+        "           USING(warp_id, skycell_id, tess_id)\n"
         "       WHERE\n"
-        "           p4Run.state = 'run'\n" 
+        "           warpRun.state = 'run'\n" 
         "       GROUP BY\n"
-        "           p4Run.p4_id\n"  
+        "           warpRun.warp_id\n"  
         "       HAVING\n"
-        "       COUNT(p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"
+        "       COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n"
         "       ) as Foo\n"
         "   )\n";
@@ -978,5 +978,5 @@
     char *query =
         "CREATE TEMPORARY TABLE finished\n"
-        " (p4_id INT, PRIMARY KEY(p4_id)) ENGINE=MEMORY\n";
+        " (warp_id INT, PRIMARY KEY(warp_id)) ENGINE=MEMORY\n";
 
     if (!p_psDBRunQuery(config->dbh, query)) {
@@ -990,21 +990,21 @@
         "INSERT INTO finished\n"
         " SELECT\n"
-        "   p4_id\n"
+        "   warp_id\n"
         " FROM\n"
         "   (SELECT DISTINCT\n"
-        "       p4Run.p4_id,\n"
-        "       p4SkyCellMap.p4_id as foo,\n"
-        "       p4Skyfile.p4_id as bar\n"
-        "   FROM p4Run\n"
-        "   JOIN p4SkyCellMap\n"
-        "       USING(p4_id)\n"
-        "   LEFT JOIN p4Skyfile\n"
-        "       USING(p4_id, skycell_id, tess_id)\n"
+        "       warpRun.warp_id,\n"
+        "       warpSkyCellMap.warp_id as foo,\n"
+        "       warpSkyfile.warp_id as bar\n"
+        "   FROM warpRun\n"
+        "   JOIN warpSkyCellMap\n"
+        "       USING(warp_id)\n"
+        "   LEFT JOIN warpSkyfile\n"
+        "       USING(warp_id, skycell_id, tess_id)\n"
         "   WHERE\n"
-        "       p4Run.state = 'run'\n" 
+        "       warpRun.state = 'run'\n" 
         "   GROUP BY\n"
-        "       p4Run.p4_id\n"  
+        "       warpRun.warp_id\n"  
         "   HAVING\n"
-        "       COUNT(p4SkyCellMap.p4_id) = COUNT(p4Skyfile.p4_id)\n"
+        "       COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)\n"
         " ) as Foo \n";
 
@@ -1017,10 +1017,10 @@
 {    
     char *query =
-        "UPDATE p4Run\n"
-        "   SET p4Run.state = 'stop'\n"
+        "UPDATE warpRun\n"
+        "   SET warpRun.state = 'stop'\n"
         " WHERE\n"
-        "   p4Run.p4_id =\n"
+        "   warpRun.warp_id =\n"
         "   (SELECT DISTINCT\n"
-        "       p4_id\n"
+        "       warp_id\n"
         "   FROM finished\n"
         "   )\n";
@@ -1050,14 +1050,14 @@
     psString query = psStringCopy( 
         "SELECT\n"
-        "   p4Skyfile.*\n"
-        " FROM p4Run\n"
-        " JOIN p4Skyfile\n"
-        "   USING(p4_id)\n"
+        "   warpSkyfile.*\n"
+        " FROM warpRun\n"
+        " JOIN warpSkyfile\n"
+        "   USING(warp_id)\n"
         " WHERE\n"
-        "   p4Run.state = 'run'\n" 
+        "   warpRun.state = 'run'\n" 
     );
 
     if (config->where) {
-        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4Skyfile");
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "warpSkyfile");
         psStringAppend(&query, " AND %s", whereClause);
         psFree(whereClause);
@@ -1093,5 +1093,5 @@
     }
     if (!psArrayLength(output)) {
-        psError(PS_ERR_UNKNOWN, false, "no p4Skyfile rows found");
+        psError(PS_ERR_UNKNOWN, false, "no warpSkyfile rows found");
         psFree(output);
         return true;
@@ -1110,5 +1110,5 @@
     if (psArrayLength(output)) {
         // negative simple so the default is true
-        if (!ippdbPrintMetadatas(stdout, output, "p4Skyfile", !simple)) {
+        if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
             psFree(output);
@@ -1123,7 +1123,7 @@
 
 
-static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state)
-{
-    PS_ASSERT_PTR_NON_NULL(p4_id, false);
+static bool setwarpRunState(pxConfig *config, const char *warp_id, const char *state)
+{
+    PS_ASSERT_PTR_NON_NULL(warp_id, false);
     PS_ASSERT_PTR_NON_NULL(state, false);
 
@@ -1136,12 +1136,12 @@
     ) {
         psError(PS_ERR_UNKNOWN, false,
-                "invalid p4Run state: %s", state);
-        return false;
-    }
-
-    char *query = "UPDATE p4Run SET state = '%s' WHERE p4_id = '%s'";
-    if (!p_psDBRunQuery(config->dbh, query, state, p4_id)) {
+                "invalid warpRun state: %s", state);
+        return false;
+    }
+
+    char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = '%s'";
+    if (!p_psDBRunQuery(config->dbh, query, state, warp_id)) {
         psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for p4_id %s", p4_id);
+                "failed to change state for warp_id %s", warp_id);
         return false;
     }
