Index: trunk/ippTools/src/remotetool.c
===================================================================
--- trunk/ippTools/src/remotetool.c	(revision 36511)
+++ trunk/ippTools/src/remotetool.c	(revision 36512)
@@ -184,5 +184,5 @@
 
   // Insert the top level run object
-  remoteRunRow *run = remoteRunRowAlloc(0, // rem_id
+  remoteRunRow *run = remoteRunRowAlloc(0, // remote_id
 					"new", // state
 					stage,
@@ -206,5 +206,5 @@
     return(true);
   }
-  psS64 rem_id = psDBLastInsertID(config->dbh);
+  psS64 remote_id = psDBLastInsertID(config->dbh);
   
   psArray *list = psArrayAllocEmpty(limit);
@@ -213,5 +213,5 @@
     psS64 stage_id = psMetadataLookupS64(NULL, md, "stage_id");
 
-    remoteComponentRow *comp = remoteComponentRowAlloc(rem_id,
+    remoteComponentRow *comp = remoteComponentRowAlloc(remote_id,
 						       stage_id);
     if (!comp) {
@@ -260,5 +260,5 @@
   psMetadata *where = psMetadataAlloc();
   
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
   PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
   PXOPT_COPY_STR(config->args, where, "-stage",  "stage",  "==");
@@ -292,5 +292,5 @@
   psMetadata *where = psMetadataAlloc();
 
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
   PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
   
@@ -313,16 +313,17 @@
 {
   PS_ASSERT_PTR_NON_NULL(config, false);
-
+  PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
+  
   psMetadata *where = psMetadataAlloc();
   psMetadata *values = psMetadataAlloc();
 
   // Wheres
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
-  PXOPT_COPY_STR(config->args, where, "-label",  "label", "==");
-
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
+  
   // Values to set
+  PXOPT_COPY_STR(config->args, values, "-set_label", "label", "==");
   PXOPT_COPY_STR(config->args, values, "-set_state", "state", "==");
   PXOPT_COPY_S16(config->args, values, "-fault",     "fault", "==");
-  PXOPT_COPY_STR(config->args, values, "-set_label", "label", "==");
+  PXOPT_COPY_S64(config->args, values, "-job_id",    "job_id", "==");
 
   long rows = psDBUpdateRows(config->dbh, "remoteRun", where, values);
@@ -340,24 +341,28 @@
 {
   PS_ASSERT_PTR_NON_NULL(config, false);
-
+  PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
+  
   psMetadata *where = psMetadataAlloc();
   // Wheres
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
-
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
+  psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+  psFree(where);
+  
   psString query = NULL;
   query = pxDataGet("remotetool_updatepoll.sql");
   if (!query) {
     psError(PXTOOLS_ERR_SYS,false, "failed to retreive SQL statement");
-    psFree(where);
+    psFree(whereClause);
     return(false);
   }
 
-  if (!p_psDBRunQueryF(config->dbh, query,where)) {
+  if (!p_psDBRunQueryF(config->dbh, query,whereClause)) {
     psError(PS_ERR_UNKNOWN, false, "database error");
     psFree(query);
+    psFree(whereClause);
     return false;
   }
   psFree(query);
-  psFree(where);
+  psFree(whereClause);
   return(true);
 }
@@ -374,5 +379,5 @@
 
   // required
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
   PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
   
@@ -398,5 +403,5 @@
 
   // required
-  PXOPT_COPY_S64(config->args, where, "-rem_id", "rem_id", "==");
+  PXOPT_COPY_S64(config->args, where, "-remote_id", "remote_id", "==");
   PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
 
