Index: trunk/ippTools/src/pzgetimfiles.c
===================================================================
--- trunk/ippTools/src/pzgetimfiles.c	(revision 12131)
+++ trunk/ippTools/src/pzgetimfiles.c	(revision 14023)
@@ -161,5 +161,5 @@
             "UPDATE summitExp"
             " SET imfiles = %d"
-            " WHERE exp_id = '%s'"
+            " WHERE exp_name = '%s'"
             " AND camera = '%s'"
             " AND telescope = '%s'";
@@ -178,5 +178,5 @@
                 "DELETE FROM pzPendingExp"
                 " WHERE"
-                "   exp_id = '%s'"
+                "   exp_name = '%s'"
                 "   AND camera = '%s'"
                 "   AND telescope = '%s'";
@@ -220,5 +220,5 @@
     {
         char *query = 
-            "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY";
+            "CREATE TEMPORARY TABLE incoming (exp_name VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_name, camera, telescope, class, class_id)) ENGINE=MEMORY";
 
         if (!p_psDBRunQuery(config->dbh, query)) {
@@ -235,5 +235,5 @@
     // load the imfiles (files) into the temp table
     {
-        char *query = "INSERT INTO incoming (exp_id, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+        char *query = "INSERT INTO incoming (exp_name, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
         long inserted = p_psDBRunQueryPrepared(config->dbh, newImfiles, query);
@@ -270,17 +270,17 @@
             "INSERT INTO pzPendingImfile" 
             "   SElECT"
-            "       incoming.exp_id,"
+            "       incoming.exp_name,"
             "       incoming.camera,"
             "       incoming.telescope,"
             "       incoming.class,"
             "       incoming.class_id,"
-            "       NULL" // exp_tag, will be assigned later
+            "       NULL" // exp_id, will be assigned later
             "   FROM incoming"
             "   JOIN pzPendingExp"
-            "       USING(exp_id, camera, telescope)"
+            "       USING(exp_name, camera, telescope)"
             "   LEFT JOIN summitImfile"
-            "       USING(exp_id, camera, telescope, class, class_id)"
+            "       USING(exp_name, camera, telescope, class, class_id)"
             "   WHERE"
-            "       summitImfile.exp_id is NULL"
+            "       summitImfile.exp_name is NULL"
             "       AND summitImfile.camera is NULL"
             "       AND summitImfile.telescope is NULL"
@@ -303,5 +303,5 @@
             "INSERT INTO summitImfile" 
             "   SElECT"
-            "       incoming.exp_id,"
+            "       incoming.exp_name,"
             "       incoming.camera,"
             "       incoming.telescope,"
@@ -314,7 +314,7 @@
             "   FROM incoming"
             "   LEFT JOIN summitImfile"
-            "       USING(exp_id, camera, telescope, class, class_id)"
+            "       USING(exp_name, camera, telescope, class, class_id)"
             "   WHERE"
-            "       summitImfile.exp_id is NULL"
+            "       summitImfile.exp_name is NULL"
             "       AND summitImfile.camera is NULL"
             "       AND summitImfile.telescope is NULL"
@@ -338,10 +338,10 @@
             " SET imfiles = (SELECT COUNT(*) FROM summitImfile"
             "   WHERE"
-            "       exp_id = '%s'"
+            "       exp_name = '%s'"
             "       AND camera = '%s'"
             "       AND telescope = '%s'"
             ")" 
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -367,8 +367,8 @@
     }
 
-    // copy the summitExp row into newExp in order to create a new exp_tag
-    {
-        psString exp_tag = pxGenExpTag(config, filesetid);
-        if (!exp_tag) {
+    // copy the summitExp row into newExp in order to create a new exp_id
+    {
+        psString exp_id = pxGenExpTag(config, filesetid);
+        if (!exp_id) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -382,6 +382,6 @@
             "INSERT INTO newExp" 
             "   SElECT"
-            "       '%s'," // exp_tag
-            "       summitExp.exp_id,"
+            "       '%s'," // exp_id
+            "       summitExp.exp_name,"
             "       summitExp.camera,"
             "       summitExp.telescope,"
@@ -392,18 +392,18 @@
             "   FROM summitExp"
             "   WHERE"
-            "       summitExp.exp_id = '%s'"
+            "       summitExp.exp_name = '%s'"
             "       AND summitExp.camera = '%s'"
             "       AND summitExp.telescope = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, exp_tag, filesetid, camera, telescope)) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PS_ERR_UNKNOWN, false, "database error");
-            psFree(exp_tag);
-            return false;
-        }
-        psFree(exp_tag);
+        if (!p_psDBRunQuery(config->dbh, query, exp_id, filesetid, camera, telescope)) {
+            // rollback
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
+            psError(PS_ERR_UNKNOWN, false, "database error");
+            psFree(exp_id);
+            return false;
+        }
+        psFree(exp_id);
 
         // sanity check: we should have inserted only one row
@@ -419,15 +419,15 @@
     }
  
-    // set the exp_tag for the imfiles (files) in the exposure (fileset) that
+    // set the exp_id for the imfiles (files) in the exposure (fileset) that
     // we are investigating
     {
         char *query = 
             "UPDATE pzPendingImfile"
-            " SET exp_tag = (SELECT exp_tag from newExp"
-            "                WHERE exp_id = '%s'"
+            " SET exp_id = (SELECT exp_id from newExp"
+            "                WHERE exp_name = '%s'"
             "                AND camera = '%s'"
             "                AND telescope = '%s')"
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -450,5 +450,5 @@
             "   FROM pzPendingExp"
             "   WHERE"
-            "       pzPendingExp.exp_id = '%s'"
+            "       pzPendingExp.exp_name = '%s'"
             "       AND pzPendingExp.camera = '%s'"
             "       AND pzPendingExp.telescope = '%s'";
@@ -479,5 +479,5 @@
             "DELETE FROM pzPendingExp"
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -524,10 +524,10 @@
     // any work
     bool status = false;
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-filesetid");
+    psString exp_name = psMetadataLookupStr(&status, config->args, "-filesetid");
     if (!status) {
         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for '-filesetid'");
         return NULL;
     }
-    if (!exp_id) {
+    if (!exp_name) {
         psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
         return NULL;
@@ -596,6 +596,6 @@
         // create a new metadata to represent this line and it's values
         psMetadata *md = psMetadataAlloc();
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_name", 0, NULL, exp_name)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_name");
             psFree(md);
             psFree(tokenCursor);
