Index: trunk/ippTools/src/camtool.c
===================================================================
--- trunk/ippTools/src/camtool.c	(revision 14132)
+++ trunk/ippTools/src/camtool.c	(revision 14147)
@@ -590,5 +590,26 @@
     }
 
-    if (!p_psDBRunQuery(config->dbh, query, cam_id)) {
+    {
+        // build a query to search by cam_id
+        psMetadata *where = psMetadataAlloc();
+        if (cam_id) {
+            if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+                psFree(where);
+                psFree(query);
+                return false;
+            }
+        }
+
+        psString whereClaus = psDBGenerateWhereSQL(where, NULL);
+        psFree(where);
+        if (whereClaus) {
+            psStringAppend(&query, " %s", whereClaus);
+            psFree(whereClaus);
+        }
+
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
